feat(chart): allow disabling chart RBAC and scoping operator to namespaces#469
Open
feat(chart): allow disabling chart RBAC and scoping operator to namespaces#469
Conversation
…paces Adds two Helm values to address #468: - `rbac.create` (default true) skips chart-managed RBAC when false so operators can supply their own (e.g. via a centrally managed policy) - `watchNamespaces` (default empty) restricts the operator to a fixed list of namespaces. The chart switches from ClusterRole/ClusterRoleBinding to per-namespace Role/RoleBinding, and the manager passes `--watch-namespaces` so its informer cache only watches those namespaces (plus the operator's own namespace, for backup credentials). The manager rules are now sourced from a single `openclaw-operator.managerRules` named template so the same set is rendered into either the ClusterRole or per-namespace Roles. The `hack/check-helm-rbac-sync.sh` guard now parses that helper and asserts rbac.yaml still includes it, so a stale chart still fails CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #468.
Summary
rbac.createHelm value (defaulttrue); set tofalseto skip chart-managed RBAC so operators can supply their ownwatchNamespacesHelm value (default empty/cluster-wide); when set, the chart renders per-namespaceRole/RoleBindingpairs instead ofClusterRole/ClusterRoleBinding, and the manager passes a new--watch-namespacesflag so its informer cache is scoped to that list (plus the operator's own namespace, so backup credential lookups still work)openclaw-operator.managerRulesnamed template so the cluster-scoped and namespaced renderings stay in sync from one source of truthhack/check-helm-rbac-sync.shnow parses that helper and assertsrbac.yamlstill includes it, so removing the include or dropping a permission still fails CITest plan
go build ./...andgo vet ./...go test ./cmd/... ./internal/resources/(newparseWatchNamespacestest added)golangci-lint run ./...bash hack/check-helm-rbac-sync.shpasses; verified with negative tests that it fails when the include is removed and when a permission is droppedbash hack/sync-chart-crds.sh --checkpasseshelm lint charts/openclaw-operator/helm templaterenders correctly in three modes:ClusterRole+ClusterRoleBinding(unchanged)--set 'watchNamespaces={team-a,team-b}'→Role+RoleBindingper namespace, deployment receives--watch-namespaces=team-a,team-b--set rbac.create=false→ no RBAC objects rendered🤖 Generated with Claude Code