Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/velero/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: 1.17.1
kubeVersion: ">=1.16.0-0"
description: A Helm chart for velero
name: velero
version: 11.2.0
version: 11.3.0
home: https://github.com/vmware-tanzu/velero
icon: https://cdn-images-1.medium.com/max/1600/1*-9mb3AKnKdcL_QD3CMnthQ.png
sources:
Expand Down
9 changes: 2 additions & 7 deletions charts/velero/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,12 @@ Create the node-Agent runtime class name.

{{/*
Kubernetes version
Built-in object .Capabilities.KubeVersion.Minor can provide non-number output
For examples:
- on GKE it returns "18+" instead of "18"
- on EKS it returns "20+" instead of "20"
*/}}
{{- define "chart.KubernetesVersion" -}}
{{- $minorVersion := .Capabilities.KubeVersion.Minor | regexFind "[0-9]+" -}}
{{- printf "%s.%s" .Capabilities.KubeVersion.Major $minorVersion -}}
{{- $version := .Capabilities.KubeVersion.Version | regexFind "v[0-9]+\\.[0-9]+\\.[0-9]+" -}}
{{- printf "%s" $version -}}
{{- end -}}


{{/*
Calculate the checksum of the credentials secret.
*/}}
Expand Down
43 changes: 34 additions & 9 deletions charts/velero/templates/cleanup-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Using this on production systems, especially those that have multiple releases of Velero, will be destructive.
{{/* 'securityContext' got renamed to 'podSecurityContext', merge both dicts into one for backward compatibility */}}
{{- $podSecurityContext := merge (.Values.podSecurityContext | default dict) (.Values.securityContext | default dict) -}}
{{/* Define the list of resources to clean up */}}
{{- $cleanupResources := list "restore" "backup" "backupstoragelocation" "volumesnapshotlocation" "podvolumerestore" -}}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -37,6 +39,32 @@ spec:
{{- end }}
{{- end }}
serviceAccountName: {{ include "velero.serverServiceAccount" . }}
initContainers:
{{- range $cleanupResources }}
- name: delete-{{ . }}
{{- if $.Values.kubectl.image.digest }}
image: "{{ $.Values.kubectl.image.repository }}@{{ $.Values.kubectl.image.digest }}"
{{- else if $.Values.kubectl.image.tag }}
image: "{{ $.Values.kubectl.image.repository }}:{{ $.Values.kubectl.image.tag }}"
{{- else }}
image: "{{ $.Values.kubectl.image.repository }}:{{ template "chart.KubernetesVersion" $ }}"
{{- end }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
command:
- /bin/kubectl
args:
- delete
- {{ . }}
- --all
{{- with $.Values.kubectl.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $.Values.kubectl.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
containers:
- name: kubectl
{{- if .Values.kubectl.image.digest }}
Expand All @@ -48,15 +76,12 @@ spec:
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /bin/sh
- -c
- >
kubectl delete restore --all;
kubectl delete backup --all;
kubectl delete backupstoragelocation --all;
kubectl delete volumesnapshotlocation --all;
kubectl delete podvolumerestore --all;
kubectl delete crd -l component=velero;
- /bin/kubectl
args:
- delete
- crd
- -l
- component=velero
{{- with .Values.kubectl.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
Expand Down
12 changes: 7 additions & 5 deletions charts/velero/templates/label-namespace/labelnamespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ spec:
image: "{{ .Values.kubectl.image.repository }}:{{ template "chart.KubernetesVersion" . }}"
{{- end }}
command:
- /bin/sh
- -c
- |
- /bin/kubectl
args:
- label
- namespace
- {{ .Release.Namespace }}
{{- range $key, $value := .Values.namespace.labels }}
kubectl label namespace {{ $.Release.Namespace }} {{ $key }}={{ $value }}
- {{ $key }}={{ $value }}
{{- end }}
{{- if .Values.kubectl.extraVolumeMounts }}
volumeMounts:
Expand All @@ -45,4 +47,4 @@ spec:
{{- end }}
backoffLimit: 3
{{- end }}
{{- end }}
{{- end }}
43 changes: 7 additions & 36 deletions charts/velero/templates/upgrade-crds/upgrade-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,6 @@ spec:
{{- end }}
serviceAccountName: {{ include "velero.serverServiceAccount" . }}-upgrade-crds
automountServiceAccountToken: {{ .Values.upgradeCRDsJob.automountServiceAccountToken }}
initContainers:
- name: kubectl
{{- if .Values.kubectl.image.digest }}
image: "{{ .Values.kubectl.image.repository }}@{{ .Values.kubectl.image.digest }}"
{{- else if .Values.kubectl.image.tag }}
image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}"
{{- else }}
image: "{{ .Values.kubectl.image.repository }}:{{ template "chart.KubernetesVersion" . }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /bin/sh
args:
- -c
- cp `which sh` /tmp && cp `which kubectl` /tmp
{{- with .Values.kubectl.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.kubectl.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /tmp
name: crds
containers:
- name: velero
{{- if .Values.image.digest }}
Expand All @@ -75,10 +49,11 @@ spec:
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- {{ .Values.upgradeCRDsJob.shellCmd | default "/tmp/sh" }}
- /velero
args:
- -c
- {{ .Values.upgradeCRDsJob.updateCmd | default "/velero install --crds-only --dry-run -o yaml | /tmp/kubectl apply -f -" }}
- install
- --crds-only
- --apply
{{- with .Values.upgradeJobResources }}
resources:
{{- toYaml . | nindent 12 }}
Expand All @@ -87,10 +62,8 @@ spec:
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /tmp
name: crds
{{- if (.Values.upgradeCRDsJob).extraVolumeMounts }}
volumeMounts:
{{- toYaml .Values.upgradeCRDsJob.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if (.Values.upgradeCRDsJob).extraEnvVars }}
Expand All @@ -99,12 +72,10 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if (.Values.upgradeCRDsJob).extraVolumes }}
volumes:
- name: crds
emptyDir: {}
{{- if (.Values.upgradeCRDsJob).extraVolumes }}
{{- toYaml .Values.upgradeCRDsJob.extraVolumes | nindent 8 }}
{{- end }}
{{- end }}
restartPolicy: OnFailure
{{- with $podSecurityContext }}
securityContext:
Expand Down
Loading
Loading