From 070aae153fe0931f132c9fadc7f6b1052d9c8a96 Mon Sep 17 00:00:00 2001 From: Abhinandan Purkait Date: Wed, 27 Mar 2024 10:35:25 +0000 Subject: [PATCH] fix: crds getting removed on helm upgrades Signed-off-by: Abhinandan Purkait --- ct.yaml | 1 + .../charts/charts/crds/templates/_helpers.tpl | 18 +----------------- .../charts/charts/crds/templates/lvmnode.yaml | 3 --- .../charts/crds/templates/lvmsnapshot.yaml | 3 --- .../charts/crds/templates/lvmvolume.yaml | 3 --- 5 files changed, 2 insertions(+), 26 deletions(-) diff --git a/ct.yaml b/ct.yaml index 6d1303bb..7959faf3 100644 --- a/ct.yaml +++ b/ct.yaml @@ -4,3 +4,4 @@ target-branch: develop chart-dirs: - deploy/helm helm-extra-args: --timeout=500s +validate-maintainers: false diff --git a/deploy/helm/charts/charts/crds/templates/_helpers.tpl b/deploy/helm/charts/charts/crds/templates/_helpers.tpl index 8534b185..8e6eef83 100644 --- a/deploy/helm/charts/charts/crds/templates/_helpers.tpl +++ b/deploy/helm/charts/charts/crds/templates/_helpers.tpl @@ -1,20 +1,4 @@ -{{/* - This returns a "1" if the CRD is absent in the cluster - Usage: - {{- if (include "crdIsAbsent" (list )) -}} - # CRD Yaml - {{- end -}} -*/}} -{{- define "crdIsAbsent" -}} - {{- $crdName := index . 0 -}} - {{- $crd := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" $crdName -}} - {{- $output := "1" -}} - {{- if $crd -}} - {{- $output = "" -}} - {{- end -}} - - {{- $output -}} -{{- end -}} +{{/* vim: set filetype=mustache: */}} {{/* Adds extra annotations to CRDs. This targets two scenarios: preventing CRD recycling in case diff --git a/deploy/helm/charts/charts/crds/templates/lvmnode.yaml b/deploy/helm/charts/charts/crds/templates/lvmnode.yaml index 2de3159b..6ac4348f 100644 --- a/deploy/helm/charts/charts/crds/templates/lvmnode.yaml +++ b/deploy/helm/charts/charts/crds/templates/lvmnode.yaml @@ -1,6 +1,4 @@ {{- if .Values.lvmLocalPv.enabled -}} -{{- $crdName := "lvmnodes.local.openebs.io" -}} -{{- if (include "crdIsAbsent" (list $crdName)) -}} ############################################## ########### ############ ########### LVMNode CRD ############ @@ -177,5 +175,4 @@ status: plural: "" conditions: [] storedVersions: [] -{{- end -}} {{- end -}} \ No newline at end of file diff --git a/deploy/helm/charts/charts/crds/templates/lvmsnapshot.yaml b/deploy/helm/charts/charts/crds/templates/lvmsnapshot.yaml index 5728f483..e53120eb 100644 --- a/deploy/helm/charts/charts/crds/templates/lvmsnapshot.yaml +++ b/deploy/helm/charts/charts/crds/templates/lvmsnapshot.yaml @@ -1,6 +1,4 @@ {{- if .Values.lvmLocalPv.enabled -}} -{{- $crdName := "lvmsnapshots.local.openebs.io" -}} -{{- if (include "crdIsAbsent" (list $crdName)) -}} ############################################## ########### ############ ########### LVMSnapshot CRD ############ @@ -85,5 +83,4 @@ status: plural: "" conditions: [] storedVersions: [] -{{- end -}} {{- end -}} \ No newline at end of file diff --git a/deploy/helm/charts/charts/crds/templates/lvmvolume.yaml b/deploy/helm/charts/charts/crds/templates/lvmvolume.yaml index 68edbf40..8c1a5c1e 100644 --- a/deploy/helm/charts/charts/crds/templates/lvmvolume.yaml +++ b/deploy/helm/charts/charts/crds/templates/lvmvolume.yaml @@ -1,6 +1,4 @@ {{- if .Values.lvmLocalPv.enabled -}} -{{- $crdName := "lvmvolumes.local.openebs.io" -}} -{{- if (include "crdIsAbsent" (list $crdName)) -}} ############################################## ########### ############ ########### LVMVolume CRD ############ @@ -153,5 +151,4 @@ status: plural: "" conditions: [] storedVersions: [] -{{- end -}} {{- end -}} \ No newline at end of file