Skip to content

Commit

Permalink
Adding plugins for all providers
Browse files Browse the repository at this point in the history
Signed-off-by: W. Kavanaugh Latiolais <kavlatiolais@gmail.com>
  • Loading branch information
kav committed Aug 18, 2020
1 parent a7fc41b commit 5d05683
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
22 changes: 5 additions & 17 deletions charts/velero/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,10 @@ Create the volume snapshot location 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 -}}
{{- define "velero.image-from-values" -}}
{{- if .digest }}
{{- .repository }}@{{ .digest }}
{{- else }}
{{- .repository }}:{{ .tag }}
{{- end -}}
{{- end -}}

22 changes: 9 additions & 13 deletions charts/velero/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.configuration.provider -}}
{{- $provider := .Values.configuration.provider -}}
{{- $providers := list .Values.configuration.provider .Values.configuration.backupStorageLocation.provider .Values.configuration.volumeSnapshotLocation.provider | compact | uniq -}}
{{- $provider := first $providers -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -43,11 +44,7 @@ spec:
{{- end }}
containers:
- name: velero
{{- if .Values.image.digest }}
image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
image: {{include "velero.image-from-values" .Values.image }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.metrics.enabled }}
ports:
Expand Down Expand Up @@ -138,16 +135,15 @@ spec:
{{- end }}
{{- end }}
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 }}
{{- range $providers }}
{{- $pluginImage := get $.Values.pluginImages . }}
- name: velero-plugin-for-{{.}}
image: {{include "velero.image-from-values" $pluginImage }}
imagePullPolicy: {{ $pluginImage.pullPolicy }}
volumeMounts:
- mountPath: /target
name: plugins
{{- end }}
{{- if .Values.initContainers }}
{{- toYaml .Values.initContainers | nindent 8 }}
{{- end }}
Expand Down
32 changes: 23 additions & 9 deletions charts/velero/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,29 @@ 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
pluginImages:
alibabacloud:
repository: registry.cn-hangzhou.aliyuncs.com/acs/velero-plugin-alibabacloud
tag: v1.1.0
pullPolicy: IfNotPresent
aws:
repository: velero/velero-plugin-for-aws
tag: v1.1.0
pullPolicy: IfNotPresent
azure:
repository: velero/velero-plugin-for-microsoft-azure
tag: v1.1.0
pullPolicy: IfNotPresent
csi:
repository: velero/velero-plugin-for-csi
tag: v0.1.1
pullPolicy: IfNotPresent
gcp:
repository: velero/velero-plugin-for-gcp
tag: v1.1.0
pullPolicy: IfNotPresent



# Annotations to add to the Velero deployment's pod template. Optional.
#
Expand Down

0 comments on commit 5d05683

Please sign in to comment.