From e2cc56144fa3a220a06bf2cb5557cb85e949a282 Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Thu, 10 Oct 2024 17:03:27 +0200 Subject: [PATCH] helm: keep namespace in manager.yaml and remove from helm overlay Signed-off-by: Eguzki Astiz Lezaun --- Makefile | 4 ++-- .../limitador-operator/templates/manifests.yaml | 16 ++++++++++++++++ config/deploy-develmode/kustomization.yaml | 2 +- config/deploy/kustomization.yaml | 7 ------- config/deploy/namespace.yaml | 7 ------- config/helm/kustomization.yaml | 14 ++++++++++++++ config/manager/manager.yaml | 6 ++++++ 7 files changed, 39 insertions(+), 17 deletions(-) delete mode 100644 config/deploy/kustomization.yaml delete mode 100644 config/deploy/namespace.yaml diff --git a/Makefile b/Makefile index 7b785b34..82ca5e72 100644 --- a/Makefile +++ b/Makefile @@ -291,7 +291,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/deploy | kubectl apply -f - + $(KUSTOMIZE) build config/default | kubectl apply -f - cd config/manager && $(KUSTOMIZE) edit set image controller=${DEFAULT_IMG} deploy-develmode: manifests kustomize ## Deploy controller in debug mode to the K8s cluster specified in ~/.kube/config. @@ -300,7 +300,7 @@ deploy-develmode: manifests kustomize ## Deploy controller in debug mode to the cd config/manager && $(KUSTOMIZE) edit set image controller=${DEFAULT_IMG} undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/deploy | kubectl delete -f - + $(KUSTOMIZE) build config/default | kubectl delete -f - .PHONY: install-olm install-olm: $(OPERATOR_SDK) diff --git a/charts/limitador-operator/templates/manifests.yaml b/charts/limitador-operator/templates/manifests.yaml index b4b7b4c3..7eb97e6d 100644 --- a/charts/limitador-operator/templates/manifests.yaml +++ b/charts/limitador-operator/templates/manifests.yaml @@ -3,6 +3,8 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + labels: + app.kubernetes.io/managed-by: helm name: limitadors.limitador.kuadrant.io spec: group: limitador.kuadrant.io @@ -1180,12 +1182,15 @@ kind: ServiceAccount metadata: labels: app: limitador-operator + app.kubernetes.io/managed-by: helm name: limitador-operator-controller-manager namespace: '{{ .Release.Namespace }}' --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: + labels: + app.kubernetes.io/managed-by: helm name: limitador-operator-leader-election-role namespace: '{{ .Release.Namespace }}' rules: @@ -1214,6 +1219,8 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: + labels: + app.kubernetes.io/managed-by: helm name: limitador-operator-manager-role rules: - apiGroups: @@ -1290,6 +1297,8 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: + labels: + app.kubernetes.io/managed-by: helm name: limitador-operator-leader-election-rolebinding namespace: '{{ .Release.Namespace }}' roleRef: @@ -1304,6 +1313,8 @@ subjects: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: + labels: + app.kubernetes.io/managed-by: helm name: limitador-operator-manager-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io @@ -1330,6 +1341,8 @@ data: resourceName: 3745a16e.kuadrant.io kind: ConfigMap metadata: + labels: + app.kubernetes.io/managed-by: helm name: limitador-operator-manager-config namespace: '{{ .Release.Namespace }}' --- @@ -1337,6 +1350,7 @@ apiVersion: v1 kind: Service metadata: labels: + app.kubernetes.io/managed-by: helm control-plane: controller-manager name: limitador-operator-metrics namespace: '{{ .Release.Namespace }}' @@ -1353,6 +1367,7 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: + app.kubernetes.io/managed-by: helm control-plane: controller-manager name: limitador-operator-controller-manager namespace: '{{ .Release.Namespace }}' @@ -1365,6 +1380,7 @@ spec: metadata: labels: app: limitador-operator + app.kubernetes.io/managed-by: helm control-plane: controller-manager spec: containers: diff --git a/config/deploy-develmode/kustomization.yaml b/config/deploy-develmode/kustomization.yaml index 4c57687f..6f8ede98 100644 --- a/config/deploy-develmode/kustomization.yaml +++ b/config/deploy-develmode/kustomization.yaml @@ -2,6 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - ../deploy + - ../default patchesStrategicMerge: - devel_mode_patch.yaml diff --git a/config/deploy/kustomization.yaml b/config/deploy/kustomization.yaml deleted file mode 100644 index 8476736d..00000000 --- a/config/deploy/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: limitador-operator-system -resources: -- namespace.yaml -- ../default diff --git a/config/deploy/namespace.yaml b/config/deploy/namespace.yaml deleted file mode 100644 index fb78ef5f..00000000 --- a/config/deploy/namespace.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - labels: - control-plane: controller-manager - name: system diff --git a/config/helm/kustomization.yaml b/config/helm/kustomization.yaml index e8866a66..2a0f90d0 100644 --- a/config/helm/kustomization.yaml +++ b/config/helm/kustomization.yaml @@ -2,5 +2,19 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: "{{ .Release.Namespace }}" + +labels: + - pairs: + app.kubernetes.io/managed-by: helm + includeTemplates: true + resources: - ../default + +patches: +- patch: |- + $patch: delete + apiVersion: v1 + kind: Namespace + metadata: + name: limitador-operator-system diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 167c84a0..334d1582 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -1,3 +1,9 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + control-plane: controller-manager + name: system --- apiVersion: apps/v1 kind: Deployment