From fae8e5cc7eb4e2e94b811d7f3d597dd5a77158db Mon Sep 17 00:00:00 2001 From: "W. Kavanaugh Latiolais" Date: Sat, 24 Oct 2020 12:38:41 -0500 Subject: [PATCH] WIP: Adding backcompat testing Signed-off-by: W. Kavanaugh Latiolais --- README.md | 2 +- charts/velero/templates/_helpers.tpl | 8 ++++---- .../velero/templates/backupstoragelocation.yaml | 2 +- charts/velero/templates/deployment.yaml | 16 ++++++++-------- charts/velero/templates/restic-daemonset.yaml | 10 +++++----- .../velero/templates/volumesnapshotlocation.yaml | 2 +- .../back-compat-snapshot_test.yaml.snap | 7 +++++-- 7 files changed, 25 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index dcdb4c843..3fd8b7635 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/charts/velero/templates/_helpers.tpl b/charts/velero/templates/_helpers.tpl index 1a22057b6..fd43cbcc2 100644 --- a/charts/velero/templates/_helpers.tpl +++ b/charts/velero/templates/_helpers.tpl @@ -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" -}} diff --git a/charts/velero/templates/backupstoragelocation.yaml b/charts/velero/templates/backupstoragelocation.yaml index 6fd14d911..9d968486c 100644 --- a/charts/velero/templates/backupstoragelocation.yaml +++ b/charts/velero/templates/backupstoragelocation.yaml @@ -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 }} diff --git a/charts/velero/templates/deployment.yaml b/charts/velero/templates/deployment.yaml index f462960e1..60da605e7 100644 --- a/charts/velero/templates/deployment.yaml +++ b/charts/velero/templates/deployment.yaml @@ -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 }} @@ -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 }} diff --git a/charts/velero/templates/restic-daemonset.yaml b/charts/velero/templates/restic-daemonset.yaml index 5ed94a4e3..8de90a32c 100644 --- a/charts/velero/templates/restic-daemonset.yaml +++ b/charts/velero/templates/restic-daemonset.yaml @@ -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 }} @@ -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 }} @@ -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 }} diff --git a/charts/velero/templates/volumesnapshotlocation.yaml b/charts/velero/templates/volumesnapshotlocation.yaml index 2b9455eb8..489603bb3 100644 --- a/charts/velero/templates/volumesnapshotlocation.yaml +++ b/charts/velero/templates/volumesnapshotlocation.yaml @@ -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 -}} diff --git a/charts/velero/tests/__snapshot__/back-compat-snapshot_test.yaml.snap b/charts/velero/tests/__snapshot__/back-compat-snapshot_test.yaml.snap index 86525367c..78c6524d1 100644 --- a/charts/velero/tests/__snapshot__/back-compat-snapshot_test.yaml.snap +++ b/charts/velero/tests/__snapshot__/back-compat-snapshot_test.yaml.snap @@ -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