fix(ops): name the cluster on every guarded kubectl call before the rebuild #977
No reviewers
Labels
No labels
burndown-2026-06
burndown-2026-08
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
coherence-core
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
qa-fixture
role/advocate
role/director
role/exec
role/frontend
role/gamedev
role/human
role/platform
role/qa
role/science
role/sysadmin
state
ambient
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-flight-deck/infrastructure!977
Loading…
Reference in a new issue
No description provided.
Delete branch "aos/claude/mt75-kubectl-context-callsites"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the infrastructure half of agentic-os#1352, a regression I introduced in agentic-os#1349.
Why now
#1349 made
--contextmandatory onaosguard ops kubectl. It binds at the next aosguard rebuild, not today, so this is latent. At that moment every call written without the flag starts failing closed, in a deny that mentions #1349 nowhere:65 call sites here were written without it. This has to land before the rebuild, or the first person to hit it debugs a fail-closed deny with no link to the change that caused it.
The two scripts, which are the part that actually breaks
bootstrap-ser8-forgejo-runner-canary.sh- 19 calls, all now naming ser8. Worth stating plainly: this script targets ser8 by name and applies throughremoteonto a host whose active kubeconfig context is not guaranteed to be ser8. An unnamed target on a remote mutation is precisely the ambiguity #1349 exists to catch, so this file is the strongest argument for the guard rather than against it.forgejo-external-account-lockdown-rollout.sh- acontextvariable defaulting tokai-server, overridable viaKUBE_CONTEXT. Both of its surfaces are kai-server: the Forgejo server, and the scoped runners that ser8 superseded but which still sit at 0 replicas on that cluster.I checked rather than inferred from filenames:
forgejo-86b7b6f66fandforgejo-db-0run on kai-server; ser8'sforgejonamespace carries only runners.The flag goes after the verb. aosguard's own urfave/cli parser eats a leading
--contextas an unknown global flag (flag provided but not defined: -context). A mechanical prefix rewrite would have silently broken all 19 calls it touched. Vera found that parser behaviour; it is the reason this is not a one-line sed.The runbooks
39 commands across 11 files take
--context <cluster>, a placeholder rather than a value. Hardcodingkai-serverinto an incident recipe would be actively wrong during a ser8 incident, and<cluster>matches the<pod>/<ns>convention these files already use.Each of the five
ops-investigation-*skills gains one line naming the two valid values, so an operator learns them without first triggering a deny.Three prose mentions are deliberately untouched - they reference the surface rather than invoke it, e.g. "
aosguard ops kubectlexposes nodeleteverb".Not included
cleanup-orphaned-cluster-objects.shmentions the wrap only in a comment as an optionalKUBECTL=value, and its actual verb isdelete, which the wrap never exposed. Unaffected in practice.Verification
bash -nclean on both scripts,pre-commit run --all-filesgreen including shellcheck and the Markdown size caps.A transform assertion caught me mid-change: I had counted 3 call sites in the bootstrap script from a truncated grep, and the script has 19. The count in this PR is from the transform itself, not from my earlier reading.