From 54dbed49ab02ac8d4e38ea7a88e4510a33607938 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 --- .../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 57d9545bd8..33ba573cd0 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.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -1146,6 +1147,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -2389,6 +2391,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -2876,6 +2879,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -3484,6 +3488,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -3840,6 +3845,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -6598,6 +6604,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -7775,6 +7782,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -9098,6 +9106,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 + helm.sh/resource-policy: keep labels: app.kubernetes.io/instance: '{{ .Release.Name }}' app.kubernetes.io/managed-by: '{{ .Release.Service }}' @@ -10338,6 +10347,7 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.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