fix(agent): scope secrets RBAC and robust helm-values check#210
Merged
fix(agent): scope secrets RBAC and robust helm-values check#210
Conversation
valuesEqual now normalizes numeric and boolean types before comparing, preventing false drift reports from YAML int vs JSON float64 (e.g., 1 vs 1.0) and boolean casing (True vs true). Add helm_values_check_test.go integration test wrapper so the registered TestName maps to an actual test function that the validator Job runner can invoke.
Remove cluster-wide secrets access from the default ClusterRole. Add --helm-namespaces and --helm-all-namespaces flags to snapshot and validate commands. Validate auto-derives namespaces from recipe ComponentRefs. Add --skip-helm-check to suppress the helm-values deployment check entirely. RBAC modes: no-helm (default snapshot), scoped per-NS Roles (default validate), or cluster-wide (--helm-all-namespaces). Config flows to collector via AICR_HELM_NAMESPACES env var. Fixes #211
Contributor
|
As part of documentation, do we want to include this check validator check into the example recipes? |
Member
Author
This is more global vs recipe based so just in docs which I already added. I don't think we need anything on this in the individual recipes |
xdu31
reviewed
Feb 25, 2026
xdu31
approved these changes
Feb 25, 2026
lalitadithya
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #211. Followup to #209.
Scoped secrets RBAC (fixes #211)
The agent's
aicr-node-readerClusterRole previously grantedsecrets: get, listcluster-wide. This scopes secrets access to only the namespaces where Helm components are deployed.Three RBAC modes:
snapshot)--helm-*flagsvalidate)secrets: get, list--helm-all-namespaces)secrets: get, listNew CLI flags:
--helm-namespaces ns1,ns2snapshot,validate--helm-all-namespacessnapshot,validate--skip-helm-checkvalidateFor
validate, namespaces are auto-derived from recipeComponentRefs(Helm type with non-empty namespace) when no--helm-*flags are set.Config flows to the in-cluster collector via
AICR_HELM_NAMESPACESenv var on the Job container (""= skip,"*"= all,"ns1,ns2"= scoped).Robust value comparison (from original PR)
valuesEqualhandles type normalization (numeric:"1"=="1.0", boolean:"true"=="True")TestCheckHelmValuesintegration test fileFiles changed
pkg/k8s/agent/types.goHelmNamespaces,HelmAllNamespacesfields on Configpkg/k8s/agent/rbac.gopkg/k8s/agent/deployer.gopkg/k8s/agent/permissions.gopkg/k8s/agent/job.goAICR_HELM_NAMESPACESenv var on Job containerpkg/k8s/agent/deployer_test.gopkg/collector/k8s/k8s.goHelmNamespacesfield on Collectorpkg/collector/k8s/helm.gocollectHelmReleasesScoped)pkg/collector/factory.goWithHelmNamespacesoptionpkg/collector/factory_test.goTestWithHelmNamespacespkg/snapshotter/agent.gopkg/snapshotter/snapshot.goAICR_HELM_NAMESPACESenv var in agent modepkg/cli/snapshot.go--helm-namespaces,--helm-all-namespacesflagspkg/cli/validate.go--skip-helm-check, helm flags, auto-derive from recipepkg/cli/validate_test.goTestHelmNamespacesFromRecipe(6 cases)tests/chainsaw/cli/helm-values-discovery/Test plan
go test -race ./pkg/k8s/agent/...— all tests pass (5 new, 1 updated)go test -race ./pkg/collector/...— all tests passgo test -race ./pkg/cli/...— all tests passmake lint— 0 issuesmake qualify— full check passes (12 e2e tests, up from 11)helm-values-discoverychainsaw test validates matching/mismatched/skip flows