Commit 7a8ff1f
authored
fix(control-plane): use project kube client for namespace provisioner (#1175)
## Summary
When `PROJECT_KUBE_TOKEN_FILE` is set, the project kube client carries
the TSA identity (`tenantaccess-ambient-control-plane`) which already
has `namespace-admin` RoleBindings in `ambient-code--config` — including
access to `tenantnamespaces.tenant.paas.redhat.com`. The main in-cluster
SA does not.
`buildNamespaceProvisioner` was receiving `kube` (the pod SA identity)
unconditionally. The MPP `TenantNamespace` provisioner then failed with:
```
tenantnamespaces.tenant.paas.redhat.com "test" is forbidden:
User "system:serviceaccount:ambient-code--ambient-s0:ambient-control-plane"
cannot get resource "tenantnamespaces" in API group "tenant.paas.redhat.com"
in the namespace "ambient-code--config"
```
## Fix
Three lines: prefer `projectKube` over `kube` when building the
provisioner, since that IS the identity with the right permissions
already in place.
## Test plan
- [ ] Deploy to MPP cluster with `PROJECT_KUBE_TOKEN_FILE` set — CP logs
show successful `TenantNamespace` get/create/delete without Forbidden
errors
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Namespace provisioning now supports project-specific Kubernetes tokens
when configured.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 file changed
Lines changed: 5 additions & 1 deletion
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
0 commit comments