Skip to content

Commit 43b33d1

Browse files
authored
fix(manifests): explicit namespaces per resource, drop overlay namespace transformer (#1171)
## Summary - Removes `namespace: ambient-code--runtime-int` from `kustomization.yaml` — the overlay namespace transformer was overwriting `ambient-code--config` on the tenant RBAC resources - Adds `namespace: ambient-code--runtime-int` explicitly to each resource file that needs it - Moves tenant RBAC into `tenant-rbac/` sub-kustomization so it can live in `ambient-code--config` cleanly - Adds per-sector RoleBindings for `tenantnamespaces.tenant.paas.redhat.com`: - `ambient-control-plane-rbac-runtime-int.yaml` — binds `ambient-code--runtime-int:ambient-control-plane` - `ambient-control-plane-rbac-s0.yaml` — binds `ambient-code--ambient-s0:ambient-control-plane` - Adding s1 (or any future sector) requires only a new `ambient-control-plane-rbac-s1.yaml` ## Verification ``` kustomize build components/manifests/overlays/mpp-openshift/ # Role + RoleBindings → namespace: ambient-code--config ✓ # s0 subject → namespace: ambient-code--ambient-s0 ✓ # runtime-int subject → namespace: ambient-code--runtime-int ✓ # All other resources → namespace: ambient-code--runtime-int ✓ ``` ## Test plan - [ ] Apply to MPP cluster — CP pod in `ambient-code--ambient-s0` can get/create/delete `tenantnamespaces` in `ambient-code--config` 🤖 Generated with [Claude Code](https://claude.ai/code)
2 parents 493c333 + 05a0349 commit 43b33d1

11 files changed

Lines changed: 53 additions & 38 deletions

components/manifests/overlays/mpp-openshift/ambient-api-server-db.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: v1
22
kind: Service
33
metadata:
44
name: ambient-api-server-db
5+
namespace: ambient-code--runtime-int
56
labels:
67
app: ambient-api-server
78
component: database
@@ -20,6 +21,7 @@ apiVersion: apps/v1
2021
kind: Deployment
2122
metadata:
2223
name: ambient-api-server-db
24+
namespace: ambient-code--runtime-int
2325
labels:
2426
app: ambient-api-server
2527
component: database

components/manifests/overlays/mpp-openshift/ambient-api-server-route.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: route.openshift.io/v1
22
kind: Route
33
metadata:
44
name: ambient-api-server
5+
namespace: ambient-code--runtime-int
56
labels:
67
app: ambient-api-server
78
component: api

components/manifests/overlays/mpp-openshift/ambient-api-server.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: v1
22
kind: ConfigMap
33
metadata:
44
name: ambient-api-server-auth
5+
namespace: ambient-code--runtime-int
56
labels:
67
app: ambient-api-server
78
component: auth
@@ -16,13 +17,15 @@ apiVersion: v1
1617
kind: ServiceAccount
1718
metadata:
1819
name: ambient-api-server
20+
namespace: ambient-code--runtime-int
1921
labels:
2022
app: ambient-api-server
2123
---
2224
apiVersion: apps/v1
2325
kind: Deployment
2426
metadata:
2527
name: ambient-api-server
28+
namespace: ambient-code--runtime-int
2629
labels:
2730
app: ambient-api-server
2831
component: api
@@ -145,6 +148,7 @@ apiVersion: v1
145148
kind: Service
146149
metadata:
147150
name: ambient-api-server
151+
namespace: ambient-code--runtime-int
148152
labels:
149153
app: ambient-api-server
150154
component: api

components/manifests/overlays/mpp-openshift/ambient-control-plane-rbac.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

components/manifests/overlays/mpp-openshift/ambient-control-plane-sa.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ apiVersion: v1
22
kind: ServiceAccount
33
metadata:
44
name: ambient-control-plane
5+
namespace: ambient-code--runtime-int
56
labels:
67
app: ambient-control-plane
78
---
89
apiVersion: v1
910
kind: Secret
1011
metadata:
1112
name: ambient-control-plane-token
13+
namespace: ambient-code--runtime-int
1214
annotations:
1315
kubernetes.io/service-account.name: ambient-control-plane
1416
type: kubernetes.io/service-account-token

components/manifests/overlays/mpp-openshift/ambient-control-plane.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: ambient-control-plane
5+
namespace: ambient-code--runtime-int
56
labels:
67
app: ambient-control-plane
78
spec:

components/manifests/overlays/mpp-openshift/kustomization.yaml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,15 @@ kind: Kustomization
44
metadata:
55
name: ambient-mpp-openshift
66

7-
namespace: ambient-code--runtime-int
8-
97
resources:
108
- ambient-api-server-db.yaml
119
- ambient-api-server.yaml
1210
- ambient-control-plane.yaml
1311
- ambient-api-server-route.yaml
1412
- ambient-control-plane-sa.yaml
15-
- ambient-control-plane-rbac.yaml
13+
- tenant-rbac/
1614
- ambient-tenant-ingress-netpol.yaml
1715

18-
replacements:
19-
- source:
20-
kind: ServiceAccount
21-
name: ambient-control-plane
22-
fieldPath: metadata.namespace
23-
targets:
24-
- select:
25-
kind: RoleBinding
26-
name: ambient-control-plane-tenant-namespaces
27-
fieldPaths:
28-
- subjects.0.namespace
29-
3016
patches:
3117
- path: ambient-api-server-args-patch.yaml
3218
target:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: RoleBinding
3+
metadata:
4+
name: ambient-control-plane-tenant-namespaces-runtime-int
5+
namespace: ambient-code--config
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: Role
9+
name: ambient-control-plane-tenant-namespaces
10+
subjects:
11+
- kind: ServiceAccount
12+
name: ambient-control-plane
13+
namespace: ambient-code--runtime-int
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: RoleBinding
3+
metadata:
4+
name: ambient-control-plane-tenant-namespaces-s0
5+
namespace: ambient-code--config
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: Role
9+
name: ambient-control-plane-tenant-namespaces
10+
subjects:
11+
- kind: ServiceAccount
12+
name: ambient-control-plane
13+
namespace: ambient-code--ambient-s0
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: ambient-control-plane-tenant-namespaces
5+
namespace: ambient-code--config
6+
rules:
7+
- apiGroups: ["tenant.paas.redhat.com"]
8+
resources: ["tenantnamespaces"]
9+
verbs: ["get", "list", "watch", "create", "delete"]

0 commit comments

Comments
 (0)