Skip to content

Commit

Permalink
Fixes #89 - InitContainers/Provider
Browse files Browse the repository at this point in the history
BREAKING CHANGE

Signed-off-by: W. Kavanaugh Latiolais <kavlatiolais@gmail.com>
  • Loading branch information
kav committed Aug 6, 2020
1 parent e75ddaf commit 1dba1f5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
20 changes: 20 additions & 0 deletions charts/velero/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}

14 changes: 12 additions & 2 deletions charts/velero/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions charts/velero/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
Expand Down

0 comments on commit 1dba1f5

Please sign in to comment.