Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughExtended DB queries, generated query structs, gRPC ApplyDeployment message, control-plane RPCs, and Krane apply logic to carry environment slug, region, and Git metadata (commit SHA, branch, commit message, and repository) through query results, RPC payloads, and container environment variables. Changes
Sequence Diagram(s)/* Visualizes how deployment metadata flows from DB through control plane to Krane and into pod envs */ sequenceDiagram
participant Client
participant ControlPlane as "Control Plane\n(svc/ctrl)"
participant DB as "Database"
participant Krane as "Krane\n(svc/krane)"
participant Pod
Client->>ControlPlane: Request desired deployment state
ControlPlane->>DB: Query deployment topology (includes env slug, region, git metadata)
DB-->>ControlPlane: Row with environment_slug, region_name, git_commit_sha/branch/message, git_repo
ControlPlane-->>Krane: Build ctrl.v1.ApplyDeployment (include env/region/git fields)
Krane->>Pod: Create/Update PodSpec with env vars (UNKEY_ENVIRONMENT_SLUG, UNKEY_REGION, UNKEY_GIT_*)
Pod-->>Krane: Pod metadata.name available -> UNKEY_INSTANCE_ID populated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
a3e5271 to
f15d596
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@svc/krane/internal/deployment/apply.go`:
- Around line 95-103: The env-var injection list in apply.go is missing
UNKEY_APP_SLUG and UNKEY_PROJECT_SLUG and incorrectly sets UNKEY_INSTANCE_ID
instead of UNKEY_REPLICA_ID; update the EnvVar slice where these are defined
(look for the block with Name: "UNKEY_ENVIRONMENT_SLUG", "UNKEY_REGION", etc.)
to add entries for UNKEY_APP_SLUG and UNKEY_PROJECT_SLUG with their values from
the request, and change the existing EnvVar with Name "UNKEY_INSTANCE_ID" to
Name "UNKEY_REPLICA_ID" while keeping the same ValueFrom FieldRef metadata.name
selector.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c67bf5f1-67f9-4bc7-904d-0c8b15bff4b5
⛔ Files ignored due to path filters (2)
gen/proto/ctrl/v1/cluster.pb.gois excluded by!**/*.pb.go,!**/gen/**web/apps/dashboard/gen/proto/ctrl/v1/cluster_pb.tsis excluded by!**/gen/**
📒 Files selected for processing (9)
pkg/db/deployment_topology_by_id_and_region.sql_generated.gopkg/db/deployment_topology_list_by_versions.sql_generated.gopkg/db/querier_generated.gopkg/db/queries/deployment_topology_by_id_and_region.sqlpkg/db/queries/deployment_topology_list_by_versions.sqlsvc/ctrl/proto/ctrl/v1/cluster.protosvc/ctrl/services/cluster/rpc_get_desired_deployment_state.gosvc/ctrl/services/cluster/rpc_watch_deployments.gosvc/krane/internal/deployment/apply.go
🚧 Files skipped from review as they are similar to previous changes (5)
- svc/ctrl/proto/ctrl/v1/cluster.proto
- pkg/db/queries/deployment_topology_by_id_and_region.sql
- pkg/db/queries/deployment_topology_list_by_versions.sql
- svc/ctrl/services/cluster/rpc_get_desired_deployment_state.go
- svc/ctrl/services/cluster/rpc_watch_deployments.go
38b649a to
9b02f68
Compare

What does this PR do?
As a user it would be nice to have some more info at runtime.
So we are adding some more runtime environment variables to deployment workloads by extending the
ApplyDeploymentprotobuf message with additional metadata fields. These fields include app slug, project slug, environment slug, region, and Git-related information (commit SHA, branch, repository, and commit message). The changes also add aUNKEY_REPLICA_IDenvironment variable that references the pod's metadata name.Fixes # (issue)
Type of change
How should this be tested?
UNKEY_APP_SLUG,UNKEY_PROJECT_SLUG,UNKEY_ENVIRONMENT_SLUG,UNKEY_REGION,UNKEY_GIT_COMMIT_SHA,UNKEY_GIT_BRANCH,UNKEY_GIT_REPO,UNKEY_GIT_COMMIT_MESSAGE,UNKEY_REPLICA_ID) are properly set in the running containersChecklist
Required
pnpm buildpnpm fmtmake fmton/godirectoryconsole.logsgit pull origin mainAppreciated