Skip to content

Commit 455f76c

Browse files
authored
Add namespaces to different levels of deployable kustomizations (#1475)
`apiserver` and `controller` components now have: - config/\<component\>/default/ - namespace+namePrefix only, emits no Namespace (used as a base) - config/\<component\>/standalone/ - wraps default/ and adds the ironcore-system Namespace; use this for single-component deploys Shared Namespace lives in config/namespaces/ironcore-system/. The combined config/default and config/etcdless installs reference the bases and the namespace kustomization directly, eliminating the previous remove-namespace.yaml patch dance. Build output for both is byte-identical to main (only kustomize deprecation-warning lines disappear, since the patches that triggered them are gone). The namespaces folder can be extended with additional namespaces, e.g. for the pool leases. Behavioral change for downstream consumers: users who previously ran `kustomize build config/controller/default` for a complete deploy must migrate to `config/controller/standalone`; same for `config/apiserver/default` -> `config/apiserver/standalone` (or `config/apiserver/standalone-etcdless` for the external-etcd variant). Consumers must not apply namespace transformers in overlays, these will fail once we have multiple namespaces. The Makefile install/uninstall/deploy/undeploy targets are retargeted at the standalone variants accordingly. hack/validate-kustomize.sh is also made portable (GNU realpath --relative-to is unavailable on macOS). --------- Signed-off-by: Felix Riegger <felix.riegger@sap.com>
1 parent a46b643 commit 455f76c

22 files changed

Lines changed: 55 additions & 85 deletions

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,20 @@ docker-push: ## Push docker image with the manager.
227227
.PHONY: install
228228
install: manifests kustomize ## Install API server & API services into the K8s cluster specified in ~/.kube/config. This requires APISERVER_IMG to be available for the cluster.
229229
cd config/apiserver/server && $(KUSTOMIZE) edit set image apiserver=${APISERVER_IMG}
230-
kubectl apply -k config/apiserver/default
230+
kubectl apply -k config/apiserver/standalone
231231

232232
.PHONY: uninstall
233233
uninstall: manifests kustomize ## Uninstall API server & API services from the K8s cluster specified in ~/.kube/config.
234-
kubectl delete -k config/apiserver/default
234+
kubectl delete -k config/apiserver/standalone
235235

236236
.PHONY: deploy
237237
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
238238
cd config/controller/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG}
239-
kubectl apply -k config/controller/default
239+
kubectl apply -k config/controller/standalone
240240

241241
.PHONY: undeploy
242242
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
243-
kubectl delete -k config/controller/default
243+
kubectl delete -k config/controller/standalone
244244

245245
##@ Kind Deployment plumbing
246246

config/apiserver/kind/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

44
resources:
5-
- ../default
5+
- ../standalone
66

77
patchesStrategicMerge:
88
- patch-apiserver.yaml

config/apiserver/server/server.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
labels:
5-
control-plane: apiserver
6-
name: system
7-
---
81
apiVersion: apps/v1
92
kind: Deployment
103
metadata:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Standalone install of the ironcore apiserver against an external etcd
2+
# (no in-cluster etcd StatefulSet): same content as config/apiserver/etcdless
3+
# plus the ironcore-system Namespace.
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
7+
resources:
8+
- ../etcdless
9+
- ../../namespaces/ironcore-system
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Standalone install of the ironcore apiserver (with the bundled etcd
2+
# StatefulSet): same content as config/apiserver/default plus the
3+
# ironcore-system Namespace. Use this when deploying the apiserver without
4+
# the controller manager.
5+
apiVersion: kustomize.config.k8s.io/v1beta1
6+
kind: Kustomization
7+
8+
resources:
9+
- ../default
10+
- ../../namespaces/ironcore-system

config/controller/kind/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

44
resources:
5-
- ../default
5+
- ../standalone
66

77
patchesStrategicMerge:
88
- patch-manager.yaml

config/controller/manager/manager.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
labels:
5-
control-plane: controller-manager
6-
name: system
7-
---
81
apiVersion: apps/v1
92
kind: Deployment
103
metadata:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Standalone install of the ironcore controller manager: same content as
2+
# config/controller/default plus the ironcore-system Namespace. Use this when
3+
# deploying the controller without the apiserver. The combined config/default
4+
# install references the Namespace kustomization directly, not via this
5+
# wrapper.
6+
apiVersion: kustomize.config.k8s.io/v1beta1
7+
kind: Kustomization
8+
9+
resources:
10+
- ../default
11+
- ../../namespaces/ironcore-system

config/default/apiserver/kustomization.yaml

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

config/default/apiserver/remove-namespace.yaml

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

0 commit comments

Comments
 (0)