From 3a7ec61e201e9b3509396efa0b9e286d397c3c3b Mon Sep 17 00:00:00 2001 From: Casey Buto Date: Wed, 6 Dec 2023 11:05:46 -0500 Subject: [PATCH 1/2] feat: Add additional templating options for Velero upgradeCRDs job Signed-off-by: Casey Buto --- charts/velero/Chart.yaml | 2 +- .../templates/upgrade-crds/upgrade-crds.yaml | 15 +++++++++++++++ charts/velero/values.yaml | 8 ++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/charts/velero/Chart.yaml b/charts/velero/Chart.yaml index db25de04..e7de334e 100644 --- a/charts/velero/Chart.yaml +++ b/charts/velero/Chart.yaml @@ -3,7 +3,7 @@ appVersion: 1.12.2 kubeVersion: ">=1.16.0-0" description: A Helm chart for velero name: velero -version: 5.1.6 +version: 5.1.7 home: https://github.com/vmware-tanzu/velero icon: https://cdn-images-1.medium.com/max/1600/1*-9mb3AKnKdcL_QD3CMnthQ.png sources: diff --git a/charts/velero/templates/upgrade-crds/upgrade-crds.yaml b/charts/velero/templates/upgrade-crds/upgrade-crds.yaml index 44dd2c44..22a5a3f1 100644 --- a/charts/velero/templates/upgrade-crds/upgrade-crds.yaml +++ b/charts/velero/templates/upgrade-crds/upgrade-crds.yaml @@ -86,9 +86,24 @@ spec: volumeMounts: - mountPath: /tmp name: crds + {{- if .Values.upgradeCRDsJob.extraVolumeMounts }} + {{- toYaml .Values.upgradeCRDsJob.extraVolumeMounts | nindent 12 }} + {{- end }} + {{- if .Values.upgradeCRDsJob.extraEnvVars }} + env: + {{- with .Values.upgradeCRDsJob.extraEnvVars }} + {{- range $key, $value := . }} + - name: {{ default "none" $key }} + value: {{ default "none" $value | quote }} + {{- end }} + {{- end }} + {{- end }} volumes: - name: crds emptyDir: {} + {{- if .Values.upgradeCRDsJob.extraVolumes }} + {{- toYaml .Values.upgradeCRDsJob.extraVolumes | nindent 8 }} + {{- end }} restartPolicy: OnFailure {{- with $podSecurityContext }} securityContext: diff --git a/charts/velero/values.yaml b/charts/velero/values.yaml index bc8c3c48..2337daa9 100644 --- a/charts/velero/values.yaml +++ b/charts/velero/values.yaml @@ -89,6 +89,14 @@ upgradeJobResources: {} # limits: # cpu: 100m # memory: 256Mi +upgradeCRDsJob: + # Extra volumes for the Upgrade CRDs Job. Optional. + extraVolumes: [] + # Extra volumeMounts for the Upgrade CRDs Job. Optional. + extraVolumeMounts: [] + # Extra key/value pairs to be used as environment variables. Optional. + extraEnvVars: {} + # Configure the dnsPolicy of the Velero deployment # See: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy From 8b4510f6e07ee8b5652020ef474f50c9e1222437 Mon Sep 17 00:00:00 2001 From: Casey Buto Date: Fri, 8 Dec 2023 16:35:10 -0500 Subject: [PATCH 2/2] fix: avoid nil pointer due to nested values Signed-off-by: Casey Buto --- charts/velero/templates/upgrade-crds/upgrade-crds.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/velero/templates/upgrade-crds/upgrade-crds.yaml b/charts/velero/templates/upgrade-crds/upgrade-crds.yaml index 22a5a3f1..169e0552 100644 --- a/charts/velero/templates/upgrade-crds/upgrade-crds.yaml +++ b/charts/velero/templates/upgrade-crds/upgrade-crds.yaml @@ -86,10 +86,10 @@ spec: volumeMounts: - mountPath: /tmp name: crds - {{- if .Values.upgradeCRDsJob.extraVolumeMounts }} + {{- if (.Values.upgradeCRDsJob).extraVolumeMounts }} {{- toYaml .Values.upgradeCRDsJob.extraVolumeMounts | nindent 12 }} {{- end }} - {{- if .Values.upgradeCRDsJob.extraEnvVars }} + {{- if (.Values.upgradeCRDsJob).extraEnvVars }} env: {{- with .Values.upgradeCRDsJob.extraEnvVars }} {{- range $key, $value := . }} @@ -101,7 +101,7 @@ spec: volumes: - name: crds emptyDir: {} - {{- if .Values.upgradeCRDsJob.extraVolumes }} + {{- if (.Values.upgradeCRDsJob).extraVolumes }} {{- toYaml .Values.upgradeCRDsJob.extraVolumes | nindent 8 }} {{- end }} restartPolicy: OnFailure