From dae1d846a43ef7fab2a494de468a6b1779e0d5ce Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Wed, 15 May 2024 09:26:47 -0500 Subject: [PATCH] Add Helm annotation to CRDs to prevent accidental deletion. (#7811) * Add helm annotation to CRDs to prevent accidental deletion. * Add annotation to template as well. --------- Signed-off-by: Michael Montgomery (cherry picked from commit 54dbed49ab02ac8d4e38ea7a88e4510a33607938) Signed-off-by: Michael Montgomery --- .../charts/eck-operator-crds/templates/all-crds.yaml | 10 ++++++++++ hack/manifest-gen/crd_patches/v1/kustomization.yaml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml b/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml index 613252bc11..25ee9f8031 100644 --- a/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml +++ b/deploy/eck-operator/charts/eck-operator-crds/templates/all-crds.yaml @@ -3,6 +3,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -1132,6 +1133,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -2353,6 +2355,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -2840,6 +2843,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -3437,6 +3441,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -3793,6 +3798,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -6508,6 +6514,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -7663,6 +7670,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -8964,6 +8972,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -10186,6 +10195,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' diff --git a/hack/manifest-gen/crd_patches/v1/kustomization.yaml b/hack/manifest-gen/crd_patches/v1/kustomization.yaml index 80eb216486..d20458215e 100644 --- a/hack/manifest-gen/crd_patches/v1/kustomization.yaml +++ b/hack/manifest-gen/crd_patches/v1/kustomization.yaml @@ -6,5 +6,7 @@ commonLabels: app.kubernetes.io/managed-by: '{{ .Release.Service }}' app.kubernetes.io/name: '{{ include "eck-operator-crds.name" . }}' app.kubernetes.io/instance: '{{ .Release.Name }}' +commonAnnotations: + helm.sh/resource-policy: keep resources: - all-crds.yaml