Skip to content

fix(agents): grant agents-api cluster-scoped nodes:list (+ strip empty Helm docs in Platform Validate)#661

Merged
ExtraToast merged 5 commits into
mainfrom
fix/agents-api-nodes-rbac
Jun 15, 2026
Merged

fix(agents): grant agents-api cluster-scoped nodes:list (+ strip empty Helm docs in Platform Validate)#661
ExtraToast merged 5 commits into
mainfrom
fix/agents-api-nodes-rbac

Conversation

@ExtraToast

@ExtraToast ExtraToast commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Two related fixes — the first restores the prod incident fix, the second unblocks CI for it.

1. RBAC: agents-api cluster-scoped nodes:list

agents-api 502'd on setup-options, session launch, and workspace restart:

"nodes is forbidden: User system:serviceaccount:agents-system:agents-api
cannot list resource nodes in API group "" at the cluster scope"

The node-selector satisfiability preflight (spec 010) lists cluster-scoped Nodes, but the SA only had the namespaced agents-api-runner-controller Role. The 403 was mapped to a 502. Adds ClusterRole/ClusterRoleBinding agents-api-node-reader (nodes: get,list,watch). App-side graceful degradation: ExtraToast/agents#36 (merged).

Already applied out-of-band to restore service (kubectl auth can-i list nodes --as=…agents-apiyes); this makes it durable under Flux.

2. Platform Validate: strip empty Helm-rendered documents

Platform Validate was failing pre-existing (unrelated to the RBAC change) with kubeconform … missing 'kind' key (1 of 666 resources). Cause: Helm emits an empty document (just --- + # Source: comment) when a template is guarded by a false {{- if }}; kubeconform -strict treats it as a kind-less resource.

render-flux.sh now drops documents with no non-comment content before validating, logging each dropped doc with its # Source: line. A real mapping that lacks kind has non-comment content and is kept, so genuine schema errors still fail. Verified locally: a clean 713-doc render passes through unchanged; a synthetic empty doc is dropped while a real kind-less mapping is retained.

🤖 Generated with Claude Code

ExtraToast and others added 2 commits June 15, 2026 12:03
agents-api runs a node-selector satisfiability preflight (spec 010) for
setup-options and session launch/restart, which lists cluster-scoped
Nodes. The SA only had the namespaced agents-api-runner-controller Role,
so every check failed with a 403 that the API mapped to a 502 — breaking
setup-options and session launch/restart in production.

Add a ClusterRole/ClusterRoleBinding (agents-api-node-reader) granting
nodes:get,list,watch to the agents-api SA. agents-api also degrades
gracefully when this is absent (ExtraToast/agents#36); this restores
accurate preflight validation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Platform Validate failed with `kubeconform … error while parsing:
missing 'kind' key` (1 of 666 resources). The offending document is an
empty one Helm emits when a template is guarded by a false `{{- if }}`:
the `---` separator and `# Source:` comment are still rendered but the
body is not. kubeconform -strict treats that empty document as a
kind-less resource and fails the whole render — unrelated to whatever
change triggered the run.

Strip documents with no non-comment content from the rendered stream
before validating, logging each dropped document (with its `# Source:`
line) so chart churn stays visible. A genuinely malformed resource — a
mapping that really lacks `kind` — has non-comment content and is kept,
so kubeconform still catches real schema errors; this only removes
parser noise.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ExtraToast ExtraToast changed the title fix(agents): grant agents-api cluster-scoped nodes:list fix(agents): grant agents-api cluster-scoped nodes:list (+ strip empty Helm docs in Platform Validate) Jun 15, 2026
ExtraToast and others added 3 commits June 15, 2026 12:28
Temporary diagnostic: surface which document kubeconform sees as
missing 'kind' (with its # Source: line) so the offending chart can be
identified from CI logs. Will fold into the strip fix once confirmed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Finalize the strip: drop documents with neither a top-level apiVersion
nor kind (Helm empty-conditional output and flux-local's degenerate
`metadata:` fragment after the grafana Deployment). Keep any doc that
has apiVersion but no kind so genuine schema errors still fail.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ExtraToast ExtraToast merged commit 9e1904c into main Jun 15, 2026
24 checks passed
@ExtraToast ExtraToast deleted the fix/agents-api-nodes-rbac branch June 15, 2026 10:44
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