From 1dba1f5cd056192911714e27b2410bfaa8940e38 Mon Sep 17 00:00:00 2001 From: "W. Kavanaugh Latiolais" Date: Wed, 5 Aug 2020 22:12:16 -0500 Subject: [PATCH] Fixes #89 - InitContainers/Provider BREAKING CHANGE Signed-off-by: W. Kavanaugh Latiolais --- charts/velero/templates/_helpers.tpl | 20 ++++++++++++++++++++ charts/velero/templates/deployment.yaml | 14 ++++++++++++-- charts/velero/values.yaml | 19 ++++++++++++------- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/charts/velero/templates/_helpers.tpl b/charts/velero/templates/_helpers.tpl index 3ac184e63..19be9b3d4 100644 --- a/charts/velero/templates/_helpers.tpl +++ b/charts/velero/templates/_helpers.tpl @@ -110,3 +110,23 @@ Create the volume snapshot location provider {{ default .provider .volumeSnapshotLocation.provider }} {{- end -}} {{- end -}} + + +{{/* +Create the plugin provider repository name +*/}} +{{- define "velero.plugin-for-provider" -}} + {{- $provider := .Values.configuration.provider -}} + {{- with .Values.pluginImage -}} + {{- if .repository -}} + {{- .Values.pluginImage.repository -}} + {{- else if eq $provider "azure" -}} + {{- "velero/velero-plugin-for-microsoft-azure" -}} + {{- else if eq $provider "alibabacloud" }} + {{- "registry.cn-hangzhou.aliyuncs.com/acs/velero-plugin-alibabacloud" -}} + {{- else -}} + {{- "velero/velero-plugin-for-" -}}{{ $provider }} + {{- end -}} + {{- end -}} +{{- end -}} + diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index 497dc9776..6bae9445d 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -137,10 +137,20 @@ spec: key: {{ default "none" $key }} {{- end }} {{- end }} -{{- if .Values.initContainers }} initContainers: + - name: velero-plugin + {{- if .Values.pluginImage.digest }} + image: "{{ include "velero.plugin-for-provider" . }}@{{ .Values.pluginImage.digest }}" + {{- else }} + image: "{{ include "velero.plugin-for-provider" . }}:{{ .Values.pluginImage.tag }}" + {{- end }} + imagePullPolicy: {{ .Values.pluginImage.pullPolicy }} + volumeMounts: + - mountPath: /target + name: plugins + {{- if .Values.initContainers }} {{- toYaml .Values.initContainers | nindent 8 }} -{{- end }} + {{- end }} volumes: {{- if .Values.credentials.useSecret }} - name: cloud-credentials diff --git a/charts/velero/values.yaml b/charts/velero/values.yaml index 04e1434a8..e716c7e4e 100644 --- a/charts/velero/values.yaml +++ b/charts/velero/values.yaml @@ -12,6 +12,16 @@ image: # digest: pullPolicy: IfNotPresent +pluginImage: + # The plugin image repository will by default be selected using the provider property + # set a repository to override the image. + # repository: velero/velero-plugin-for-aws + tag: v1.1.0 + # Digest value example: sha256:d238835e151cec91c6a811fe3a89a66d3231d9f64d09e5f3c49552672d271f38. If used, it will + # take precedence over the image.tag. + # digest: + pullPolicy: IfNotPresent + # Annotations to add to the Velero deployment's pod template. Optional. # # If using kube2iam or kiam, use the following annotation with your AWS_ACCOUNT_ID @@ -26,14 +36,9 @@ podLabels: {} # Resource requests/limits to specify for the Velero deployment. Optional. resources: {} -# Init containers to add to the Velero deployment's pod spec. At least one plugin provider image is required. +# Init containers to add to the Velero deployment's pod spec. initContainers: [] - # - name: velero-plugin-for-aws - # image: velero/velero-plugin-for-aws:v1.1.0 - # imagePullPolicy: IfNotPresent - # volumeMounts: - # - mountPath: /target - # name: plugins + # SecurityContext to use for the Velero deployment. Optional. # Set fsGroup for `AWS IAM Roles for Service Accounts`