Skip to content

Commit

Permalink
fix: crds getting removed on helm upgrades
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinandan Purkait <[email protected]>
  • Loading branch information
Abhinandan-Purkait committed Mar 27, 2024
1 parent 549724e commit 070aae1
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 26 deletions.
1 change: 1 addition & 0 deletions ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ target-branch: develop
chart-dirs:
- deploy/helm
helm-extra-args: --timeout=500s
validate-maintainers: false
18 changes: 1 addition & 17 deletions deploy/helm/charts/charts/crds/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
{{/*
This returns a "1" if the CRD is absent in the cluster
Usage:
{{- if (include "crdIsAbsent" (list <crd-name>)) -}}
# 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
Expand Down
3 changes: 0 additions & 3 deletions deploy/helm/charts/charts/crds/templates/lvmnode.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{- if .Values.lvmLocalPv.enabled -}}
{{- $crdName := "lvmnodes.local.openebs.io" -}}
{{- if (include "crdIsAbsent" (list $crdName)) -}}
##############################################
########### ############
########### LVMNode CRD ############
Expand Down Expand Up @@ -177,5 +175,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
{{- end -}}
3 changes: 0 additions & 3 deletions deploy/helm/charts/charts/crds/templates/lvmsnapshot.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{- if .Values.lvmLocalPv.enabled -}}
{{- $crdName := "lvmsnapshots.local.openebs.io" -}}
{{- if (include "crdIsAbsent" (list $crdName)) -}}
##############################################
########### ############
########### LVMSnapshot CRD ############
Expand Down Expand Up @@ -85,5 +83,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
{{- end -}}
3 changes: 0 additions & 3 deletions deploy/helm/charts/charts/crds/templates/lvmvolume.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{{- if .Values.lvmLocalPv.enabled -}}
{{- $crdName := "lvmvolumes.local.openebs.io" -}}
{{- if (include "crdIsAbsent" (list $crdName)) -}}
##############################################
########### ############
########### LVMVolume CRD ############
Expand Down Expand Up @@ -153,5 +151,4 @@ status:
plural: ""
conditions: []
storedVersions: []
{{- end -}}
{{- end -}}

0 comments on commit 070aae1

Please sign in to comment.