Skip to content

fix(rbac): grant ci-deployer watch on deployments (unblock rollout status)#58

Merged
mastermanas805 merged 1 commit into
masterfrom
fix/ci-deployer-watch-rollout
Jun 6, 2026
Merged

fix(rbac): grant ci-deployer watch on deployments (unblock rollout status)#58
mastermanas805 merged 1 commit into
masterfrom
fix/ci-deployer-watch-rollout

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

Problem

The api/worker/provisioner Deploy workflows authenticate to prod as system:serviceaccount:kube-system:ci-deployer (via the KUBECONFIG_B64 repo secret) and run:

kubectl set image    deployment/<svc> -n <ns> ...
kubectl rollout status deployment/<svc> -n <ns>

The live ci-deployer-rollout ClusterRole granted get,list,patch,update on deployments but not watch. kubectl set image (patch/update) succeeded, but kubectl rollout status performs a WATCH and was denied:

User "system:serviceaccount:kube-system:ci-deployer" cannot watch
resource "deployments" in API group "apps" in the namespace "instant-infra"

(worker run 27053035376.) The image still landed — only the rollout-status step red, so deploys half-succeeded.

Root cause

The ci-deployer SA + ci-deployer-rollout ClusterRole + binding were applied by hand on 2026-05-15 and lived only in the cluster — there was no manifest in this repo, so the missing-watch drift was invisible and un-reviewable.

Fix

Adds the canonical manifest k8s/ci-deployer-rbac.yaml capturing the live shape and adding the missing watch on deployments (+ list/watch on deployments/status, which rollout status also reads). Least-privilege: rollout/read of existing Deployments only — no create/delete, no secret/namespace/configmap access. Applies to both instant-infra (worker/provisioner) and instant (api), since it's a cluster-scoped binding driving all three pipelines.

Verified live (impersonating the exact CI SA)

$ kubectl auth can-i watch deployments.apps -n instant-infra --as=system:serviceaccount:kube-system:ci-deployer
yes
$ kubectl rollout status deployment/instant-worker -n instant-infra --as=system:serviceaccount:kube-system:ci-deployer
deployment "instant-worker" successfully rolled out
# same for instant-api (instant) and instant-provisioner (instant-infra)

Worker is already running the latest master SHA (master-eb427f4) — the prior failure only red the status step, the set image had landed.

Operator note

infra has no auto-apply (CLAUDE.md rule 15). I already applied this live to do-nyc3-instant-prod (additive RBAC, no-op diff except the new verbs) so CI deploys unblock immediately. The manifest now matches live; a future kubectl apply -f k8s/ci-deployer-rbac.yaml is a clean no-op.

🤖 Generated with Claude Code

…atus)

The api/worker/provisioner Deploy workflows authenticate as
system:serviceaccount:kube-system:ci-deployer (via KUBECONFIG_B64) and run
`kubectl set image` + `kubectl rollout status`. The live ci-deployer-rollout
ClusterRole granted get/list/patch/update on deployments but NOT `watch`, so
`set image` succeeded while `rollout status` (which WATCHes the Deployment)
was denied in instant-infra (worker/provisioner) and instant (api):

  User "system:serviceaccount:kube-system:ci-deployer" cannot watch
  resource "deployments" in API group "apps" in the namespace "instant-infra"

(worker run 27053035376). The image still landed; only the status step red.

The ClusterRole + ClusterRoleBinding had been applied by hand on 2026-05-15
and lived only in the cluster — never in this repo. This adds the canonical
manifest (k8s/ci-deployer-rbac.yaml) capturing the live shape and ADDING the
missing `watch` on deployments (+ list/watch on deployments/status that
rollout status also reads). Least-privilege: rollout/read of existing
Deployments only; no create/delete, no secret/namespace access.

Verified live (impersonating the CI SA):
  kubectl rollout status deployment/{instant-worker,instant-api,instant-provisioner}
  --as=system:serviceaccount:kube-system:ci-deployer  → all "successfully rolled out".

Applied to do-nyc3-instant-prod (additive RBAC, no-op diff except the new
verbs). infra has no auto-apply (rule 15); manifest now matches live.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mastermanas805 mastermanas805 enabled auto-merge (squash) June 6, 2026 05:27
@mastermanas805 mastermanas805 merged commit f82b88f into master Jun 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant