diff --git a/library/common-test/tests/lists/veleroBackupStorageLocationList_test.yaml b/library/common-test/tests/lists/veleroBackupStorageLocationList_test.yaml new file mode 100644 index 00000000..ddb64f79 --- /dev/null +++ b/library/common-test/tests/lists/veleroBackupStorageLocationList_test.yaml @@ -0,0 +1,51 @@ +suite: velero backupStorageLocationList test +templates: + - common.yaml +release: + name: test-release-name + namespace: test-release-namespace +tests: + - it: should generate correct spec with aws provider and credential + set: + backupStorageLocationList: + - name: my-snap1 + enabled: true + provider: aws + credential: + aws: + id: my-id + key: my-key + objectStorage: + bucket: my-bucket + asserts: + - documentIndex: &secretDoc 0 + isKind: + of: Secret + - documentIndex: *secretDoc + isAPIVersion: + of: v1 + - documentIndex: *secretDoc + equal: + path: stringData + value: + cloud: |- + [default] + aws_access_key_id=my-id + aws_secret_access_key=my-key + - documentIndex: &backStoreLocDoc 1 + isKind: + of: BackupStorageLocation + - documentIndex: *backStoreLocDoc + isAPIVersion: + of: velero.io/v1 + - documentIndex: *backStoreLocDoc + equal: + path: spec + value: + provider: velero.io/aws + credential: + name: bsl-test-release-name-common-test-my-snap1 + key: cloud + accessMode: ReadWrite + objectStorage: + bucket: my-bucket diff --git a/library/common-test/tests/lists/veleroVolumeSnapshotLocationList_test.yaml b/library/common-test/tests/lists/veleroVolumeSnapshotLocationList_test.yaml new file mode 100644 index 00000000..2c005a19 --- /dev/null +++ b/library/common-test/tests/lists/veleroVolumeSnapshotLocationList_test.yaml @@ -0,0 +1,46 @@ +suite: velero volumeSnapshotLocationList spec test +templates: + - common.yaml +release: + name: test-release-name + namespace: test-release-namespace +tests: + - it: should generate correct spec with aws provider and credential + set: + volumeSnapshotLocationList: + - name: my-snap1 + enabled: true + provider: aws + credential: + aws: + id: my-id + key: my-key + asserts: + - documentIndex: &secretDoc 0 + isKind: + of: Secret + - documentIndex: *secretDoc + isAPIVersion: + of: v1 + - documentIndex: *secretDoc + equal: + path: stringData + value: + cloud: |- + [default] + aws_access_key_id=my-id + aws_secret_access_key=my-key + - documentIndex: &volSnapLocDoc 1 + isKind: + of: VolumeSnapshotLocation + - documentIndex: *volSnapLocDoc + isAPIVersion: + of: velero.io/v1 + - documentIndex: *volSnapLocDoc + equal: + path: spec + value: + provider: velero.io/aws + credential: + name: vsl-test-release-name-common-test-my-snap1 + key: cloud diff --git a/library/common-test/tests/lists/volumeSnapshotList_test.yaml b/library/common-test/tests/lists/volumeSnapshotList_test.yaml new file mode 100644 index 00000000..8f4147c5 --- /dev/null +++ b/library/common-test/tests/lists/volumeSnapshotList_test.yaml @@ -0,0 +1,43 @@ +suite: volumeSnapshotList spec test +templates: + - common.yaml +release: + name: test-release-name + namespace: test-release-namespace +tests: + - it: should generate correct spec + set: + volumeSnapshots: + - name: example1 + enabled: true + source: + volumeSnapshotContentName: some-name + - name: example2 + enabled: true + source: + persistentVolumeClaimName: some-pvc-name + asserts: + - documentIndex: &volumeSnapshotDoc 0 + isKind: + of: VolumeSnapshot + - documentIndex: *volumeSnapshotDoc + isAPIVersion: + of: snapshot.storage.k8s.io/v1 + - documentIndex: *volumeSnapshotDoc + equal: + path: spec + value: + source: + volumeSnapshotContentName: some-name + - documentIndex: &otherVolumeSnapshotDoc 1 + isKind: + of: VolumeSnapshot + - documentIndex: *otherVolumeSnapshotDoc + isAPIVersion: + of: snapshot.storage.k8s.io/v1 + - documentIndex: *otherVolumeSnapshotDoc + equal: + path: spec + value: + source: + persistentVolumeClaimName: some-pvc-name diff --git a/library/common/templates/loader/_lists.tpl b/library/common/templates/loader/_lists.tpl index b73d2fba..8a7c6b9e 100644 --- a/library/common/templates/loader/_lists.tpl +++ b/library/common/templates/loader/_lists.tpl @@ -10,4 +10,10 @@ {{- include "tc.v1.common.values.ingressList" . -}} + {{- include "tc.v1.common.values.backupStorageLocationList" . -}} + + {{- include "tc.v1.common.values.volumeSnapshotLocationList" . -}} + + {{- include "tc.v1.common.values.volumeSnapshotList" . -}} + {{- end -}} diff --git a/library/common/templates/values/lists/_volumeSnapshotLocationList.tpl b/library/common/templates/values/lists/_volumeSnapshotLocationList.tpl index b5696e9a..d264e741 100644 --- a/library/common/templates/values/lists/_volumeSnapshotLocationList.tpl +++ b/library/common/templates/values/lists/_volumeSnapshotLocationList.tpl @@ -1,4 +1,4 @@ -{{- define "tc.v1.common.values.volumeSnapshotList" -}} +{{- define "tc.v1.common.values.volumeSnapshotLocationList" -}} {{- $rootCtx := . -}} {{- range $idx, $vslValues := $rootCtx.Values.volumeSnapshotLocationList -}}