Skip to content

Commit

Permalink
Merge pull request #500 from Danil-Grigorev/retain-crds-on-delete
Browse files Browse the repository at this point in the history
Add helm.sh/resource-policy: keep to CRDs to prevent deletion
  • Loading branch information
k8s-ci-robot authored Apr 29, 2024
2 parents 8095eab + 5a19c98 commit 505d465
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/chart/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ bases:
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus

patches:
- path: patches/keep-crds.yaml
target:
kind: CustomResourceDefinition

patchesStrategicMerge:
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
Expand Down
6 changes: 6 additions & 0 deletions config/chart/patches/keep-crds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
"helm.sh/resource-policy": keep
name: any
7 changes: 7 additions & 0 deletions test/e2e/resources/full-chart-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.14.0
helm.sh/resource-policy: keep
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: addonproviders.operator.cluster.x-k8s.io
Expand Down Expand Up @@ -1623,6 +1624,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.14.0
helm.sh/resource-policy: keep
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: bootstrapproviders.operator.cluster.x-k8s.io
Expand Down Expand Up @@ -4825,6 +4827,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.14.0
helm.sh/resource-policy: keep
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: controlplaneproviders.operator.cluster.x-k8s.io
Expand Down Expand Up @@ -8030,6 +8033,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.14.0
helm.sh/resource-policy: keep
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: coreproviders.operator.cluster.x-k8s.io
Expand Down Expand Up @@ -11232,6 +11236,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.14.0
helm.sh/resource-policy: keep
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: infrastructureproviders.operator.cluster.x-k8s.io
Expand Down Expand Up @@ -14437,6 +14442,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.14.0
helm.sh/resource-policy: keep
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: ipamproviders.operator.cluster.x-k8s.io
Expand Down Expand Up @@ -16054,6 +16060,7 @@ metadata:
annotations:
cert-manager.io/inject-ca-from: 'default/capi-operator-serving-cert'
controller-gen.kubebuilder.io/version: v0.14.0
helm.sh/resource-policy: keep
labels:
clusterctl.cluster.x-k8s.io/core: capi-operator
name: runtimeextensionproviders.operator.cluster.x-k8s.io
Expand Down

0 comments on commit 505d465

Please sign in to comment.