fix(rbac): add namespace to RoleBinding for watch namespace permissions#65
fix(rbac): add namespace to RoleBinding for watch namespace permissions#65ian-flores merged 1 commit intomainfrom
Conversation
The RoleBinding was missing a namespace field, causing it to be created
in posit-team-system instead of posit-team. This prevented the operator
from having permissions to watch resources in the posit-team namespace.
- Add namespace: posit-team to kustomize source
- Add Makefile post-processing to template {{ .Values.watchNamespace }}
in Helm chart (matching existing pattern for other fixes)
|
Claude finished @ian-flores's task —— View job PR Review Complete
Reviewed the RBAC namespace fix. The changes correctly address the issue where the RoleBinding was missing a namespace field, causing it to be created in the wrong namespace. The sed pattern in the Makefile properly scopes the replacement to only the RoleBinding block. |
There was a problem hiding this comment.
Security Review: RBAC Changes
This PR correctly addresses a namespace targeting issue where the RoleBinding was missing a namespace, causing it to be created in the operator namespace (posit-team-system) instead of the watch namespace (posit-team).
What was reviewed:
- RBAC permissions are minimal (no new permissions added)
- Templates render correctly (verified sed pattern matches)
- Values have sensible defaults (
watchNamespace: posit-team)
Analysis:
-
Kustomize source (
config/rbac/role_binding.yaml): Adds explicitnamespace: posit-teamwhich removes the previous NOTE comment that mentioned relying on Pulumi to patch this. -
Helm chart (
dist/chart/templates/rbac/role_binding.yaml): Uses{{ .Values.watchNamespace }}making the namespace configurable, which is the correct approach. -
Makefile sed pattern: The pattern
/kind: RoleBinding/,/roleRef:/correctly scopes the replacement to only the RoleBinding block, avoiding accidental changes to the ClusterRoleBinding in the same file.
Verification:
- The sed pattern will correctly transform
namespace: posit-teamtonamespace: {{ .Values.watchNamespace }}in the generated Helm template - The
watchNamespacedefault value (posit-team) matches the hardcoded value in the kustomize source
LGTM - this is a clean fix that properly addresses the RBAC namespace issue.
Tested on
|
| Check | Status |
|---|---|
| Operator pod | ✅ Running (1/1) |
| RBAC errors | ✅ None |
| All controllers started | ✅ Site, Connect, Workbench, PackageManager, Chronicle, Flightdeck, PostgresDatabase |
| RoleBinding namespace | ✅ posit-team (correct) |
RoleBinding confirmed in correct namespace
$ kubectl get rolebinding -n posit-team team-operator-manager-rolebinding
NAME ROLE AGE
team-operator-manager-rolebinding Role/team-operator-manager-role 2m
Operator logs (clean startup)
INFO Starting Controller {"controller": "connect", ...}
INFO Starting Controller {"controller": "workbench", ...}
INFO Starting Controller {"controller": "flightdeck", ...}
INFO Starting Controller {"controller": "postgresdatabase", ...}
...
No forbidden or RBAC errors observed.
Summary
posit-teamnamespacenamespacefield, causing it to be created inposit-team-systeminstead ofposit-teamChanges
namespace: posit-teamto kustomize source (config/rbac/role_binding.yaml){{ .Values.watchNamespace }}in Helm chart (matching existing pattern for other fixes)Test plan
posit-teamnamespace