Commit 493c333
authored
fix(manifests): fix RoleBinding subject namespace via Kustomize replacement (#1168)
## Summary
Follow-up to #1167. The wired-in RBAC had two issues:
1. **Wrong subject namespace**: `subjects[0].namespace` was hardcoded to
`ambient-code--runtime-int`, but the CP runs in whatever namespace the
overlay deploys to. When deployed to `ambient-code--ambient-s0`, the
binding was silently wrong.
2. **Duplicate ClusterRole/ClusterRoleBinding**: The overlay had its own
`ClusterRole`/`ClusterRoleBinding` duplicating what
`base/rbac/control-plane-clusterrole.yaml` already provides.
## Fix
- Remove the duplicated `ClusterRole`/`ClusterRoleBinding` from
`ambient-control-plane-rbac.yaml`
- Keep only the MPP-specific `Role`/`RoleBinding` for
`tenantnamespaces.tenant.paas.redhat.com`
- Add a Kustomize `replacement` that sources `subjects[0].namespace`
from the `ambient-control-plane` ServiceAccount's `metadata.namespace` —
which Kustomize automatically rewrites to match the overlay's
`namespace:` field. Any future overlay deploying to a different
namespace gets the correct binding automatically, with zero duplication.
## Verification
```
kustomize build components/manifests/overlays/mpp-openshift/
# RoleBinding subjects[0].namespace == ambient-code--runtime-int ✓
```
## Test plan
- [ ] Apply to MPP cluster and confirm no Forbidden errors on
`tenantnamespaces` operations
- [ ] CP pod logs show successful project namespace provisioning
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Simplified permissions by removing unused role declarations.
* Improved namespace configuration synchronization for role bindings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->2 files changed
Lines changed: 12 additions & 28 deletions
File tree
- components/manifests/overlays/mpp-openshift
Lines changed: 0 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 2 | | |
31 | 3 | | |
32 | 4 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
18 | 30 | | |
19 | 31 | | |
20 | 32 | | |
| |||
0 commit comments