Skip to content

Commit

Permalink
Updates for back compat
Browse files Browse the repository at this point in the history
Flipped coalesce direction to simplify values file merge
Fixed missing configuration.provider fallback

Signed-off-by: W. Kavanaugh Latiolais <[email protected]>
  • Loading branch information
kav committed Oct 24, 2020
1 parent 12dd785 commit 42fb315
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To run unit tests in this repository please install helm-unittest

```sh
helm plugin install https://github.com/quintush/helm-unittest
helm unittest -3 charts/velero
helm unittest charts/velero
```

## License
Expand Down
8 changes: 4 additions & 4 deletions charts/velero/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,28 @@ Create the Restic priority class name.
Create the backup storage location name
*/}}
{{- define "velero.backupStorageLocation.name" -}}
{{ coalesce .Values.backupStorageLocation.name .Values.configuration.backupStorageLocation.name "default" }}
{{ coalesce .Values.configuration.backupStorageLocation.name .Values.backupStorageLocation.name "default" }}
{{- end -}}

{{/*
Create the backup storage location provider
*/}}
{{- define "velero.backupStorageLocation.provider" -}}
{{ coalesce .Values.backupStorageLocation.provider .Values.configuration.backupStorageLocation.provider .Values.provider }}
{{ coalesce .Values.configuration.backupStorageLocation.provider .Values.backupStorageLocation.provider .Values.configuration.provider .Values.provider }}
{{- end -}}

{{/*
Create the volume snapshot location name
*/}}
{{- define "velero.volumeSnapshotLocation.name" -}}
{{ coalesce .Values.volumeSnapshotLocation.name .Values.configuration.volumeSnapshotLocation.name "default" }}
{{ coalesce .Values.configuration.volumeSnapshotLocation.name .Values.volumeSnapshotLocation.name "default" }}
{{- end -}}

{{/*
Create the volume snapshot location provider
*/}}
{{- define "velero.volumeSnapshotLocation.provider" -}}
{{ coalesce .Values.volumeSnapshotLocation.provider .Values.configuration.volumeSnapshotLocation.provider .Values.provider}}
{{ coalesce .Values.configuration.volumeSnapshotLocation.provider .Values.volumeSnapshotLocation.provider .Values.configuration.provider .Values.provider}}
{{- end -}}

{{- define "velero.image-from-values" -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/velero/templates/backupstoragelocation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
helm.sh/chart: {{ include "velero.chart" . }}
spec:
provider: {{ include "velero.backupStorageLocation.provider" . }}
{{- with coalesce .Values.backupStorageLocation .Values.configuration.backupStorageLocation }}
{{- with coalesce .Values.configuration.backupStorageLocation .Values.backupStorageLocation }}
objectStorage:
bucket: {{ .bucket }}
{{- with .prefix }}
Expand Down
16 changes: 8 additions & 8 deletions charts/velero/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,25 @@ spec:
args:
- server
{{- with .Values }}
{{- with coalesce .backupSyncPeriod .configuration.backupSyncPeriod }}
{{- with coalesce .configuration.backupSyncPeriod .backupSyncPeriod }}
- --backup-sync-period={{ . }}
{{- end }}
{{- with coalesce .resticTimeout .configuration.resticTimeout }}
{{- with coalesce .configuration.resticTimeout .resticTimeout}}
- --restic-timeout={{ . }}
{{- end }}
{{- if coalesce .restoreOnlyMode .configuration.restoreOnlyMode }}
{{- if coalesce .configuration.restoreOnlyMode .restoreOnlyMode}}
- --restore-only
{{- end }}
{{- with coalesce .restoreResourcePriorities .configuration.restoreResourcePriorities }}
{{- with coalesce .configuration.restoreResourcePriorities .restoreResourcePriorities }}
- --restore-resource-priorities={{ . }}
{{- end }}
{{- with coalesce .features .configuration.features }}
{{- with coalesce .configuration.features .features }}
- --features={{ . }}
{{- end }}
{{- with coalesce .configuration.logLevel }}
{{- with coalesce .configuration.logLevel .logLevel }}
- --log-level={{ . }}
{{- end }}
{{- with coalesce .configuration.logFormat }}
{{- with coalesce .configuration.logFormat .logFormat }}
- --log-format={{ . }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -120,7 +120,7 @@ spec:
value: /credentials/cloud
{{- end }}
{{- end }}
{{- with coalesce .Values.extraEnvVars .Values.configuration.extraEnvVars }}
{{- with coalesce .Values.configuration.extraEnvVars .Values.extraEnvVars }}
{{- range $key, $value := . }}
- name: {{ default "none" $key | quote }}
value: {{ default "none" $value | quote }}
Expand Down
10 changes: 5 additions & 5 deletions charts/velero/templates/restic-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ spec:
- restic
- server
{{- with .Values }}
{{- with coalesce .features .configuration.features }}
{{- with coalesce .configuration.features .features }}
- --features={{ . }}
{{- end }}
{{- with coalesce .logLevel .configuration.logLevel }}
{{- with coalesce .configuration.logLevel .logLevel }}
- --log-level={{ . }}
{{- end }}
{{- with coalesce .logFormat .configuration.logFormat }}
{{- with coalesce .configuration.logFormat .logFormat }}
- --log-format={{ . }}
{{- end }}
{{- end }}
Expand All @@ -88,7 +88,7 @@ spec:
{{- toYaml .Values.restic.extraVolumeMounts | nindent 12 }}
{{- end }}
env:
{{- with coalesce .Values.extraEnvVars .Values.configuration.extraEnvVars }}
{{- with coalesce .Values.configuration.extraEnvVars .Values.extraEnvVars }}
{{- range $key, $value := . }}
- name: {{ default "none" $key | quote }}
value: {{ default "none" $value | quote }}
Expand Down Expand Up @@ -119,7 +119,7 @@ spec:
value: /credentials/cloud
{{- end }}
{{- end }}
{{- with coalesce .Values.extraEnvVars .Values.configuration.extraEnvVars }}
{{- with coalesce .Values.configuration.extraEnvVars .Values.extraEnvVars }}
{{- range $key, $value := . }}
- name: {{ default "none" $key | quote }}
value: {{ default "none" $value | quote }}
Expand Down
2 changes: 1 addition & 1 deletion charts/velero/templates/volumesnapshotlocation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
helm.sh/chart: {{ include "velero.chart" . }}
spec:
provider: {{ include "velero.volumeSnapshotLocation.provider" . }}
{{- with coalesce .Values.volumeSnapshotLocation.config .Values.configuration.volumeSnapshotLocation.config }}
{{- with coalesce .Values.configuration.volumeSnapshotLocation.config .Values.volumeSnapshotLocation.config }}
config:
{{ toYaml . | indent 4 }}
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ manifest should match snapshot:
helm.sh/chart: velero-2.14.0
name: default
spec:
config:
profile: test
region: us-west-1
objectStorage:
bucket: null
provider: null
bucket: velero
provider: aws
3: |
apiVersion: apps/v1
kind: DaemonSet
Expand Down

0 comments on commit 42fb315

Please sign in to comment.