diff --git a/library/common-test/tests/cnpg/credentials_test.yaml b/library/common-test/tests/cnpg/credentials_test.yaml index 321650a1..e2614a7d 100644 --- a/library/common-test/tests/cnpg/credentials_test.yaml +++ b/library/common-test/tests/cnpg/credentials_test.yaml @@ -157,3 +157,32 @@ tests: equal: path: stringData.password value: test-password + # Failures + - it: should fail with no credentials on recovery + set: + cnpg: + my-pg: + enabled: true + user: test-user + database: test-db + password: test-password + mode: recovery + recovery: + method: object_store + asserts: + - failedTemplate: + errorMessage: CNPG Recovery Provider Secret Spawner - Expected [recovery.credentials] to be defined on [recovery] mode + - it: should fail with no credentials on backup + set: + cnpg: + my-pg: + enabled: true + user: test-user + database: test-db + password: test-password + mode: backup + backups: + enabled: true + asserts: + - failedTemplate: + errorMessage: CNPG Recovery Provider Secret Spawner - Expected [backups.credentials] to be defined on [backup] mode diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 2ec1da0e..8230b9c9 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,7 +15,7 @@ maintainers: name: common sources: null type: library -version: 24.0.1 +version: 24.0.2 annotations: artifacthub.io/category: "integration-delivery" artifacthub.io/license: "BUSL-1.1" diff --git a/library/common/templates/lib/cnpg/providers/_providerSecretSpawner.tpl b/library/common/templates/lib/cnpg/providers/_providerSecretSpawner.tpl index e8c521a0..3e2db806 100644 --- a/library/common/templates/lib/cnpg/providers/_providerSecretSpawner.tpl +++ b/library/common/templates/lib/cnpg/providers/_providerSecretSpawner.tpl @@ -10,11 +10,17 @@ {{- $provider := "" -}} {{- $creds := dict -}} {{- if eq $type "backup" -}} + {{- if not $objectData.backups.credentials -}} + {{- fail "CNPG Recovery Provider Secret Spawner - Expected [backups.credentials] to be defined on [backup] mode" -}} + {{- end -}} {{/* Get the creds defined in backup.$provider */}} {{- $creds = (get $rootCtx.Values.credentials $objectData.backups.credentials) -}} {{- include "tc.v1.common.lib.credentials.validation" (dict "rootCtx" $rootCtx "caller" "CNPG Backup" "credName" $objectData.backups.credentials) -}} {{- $provider = $creds.type -}} {{- else if eq $type "recovery" -}} + {{- if not $objectData.recovery.credentials -}} + {{- fail "CNPG Recovery Provider Secret Spawner - Expected [recovery.credentials] to be defined on [recovery] mode" -}} + {{- end -}} {{/* Get the creds defined in recovery.$provider */}} {{- $creds = (get $rootCtx.Values.credentials $objectData.recovery.credentials) -}} {{- include "tc.v1.common.lib.credentials.validation" (dict "rootCtx" $rootCtx "caller" "CNPG Backup" "credName" $objectData.recovery.credentials) -}} diff --git a/library/common/templates/lib/ingress/integrations/_traefik.tpl b/library/common/templates/lib/ingress/integrations/_traefik.tpl index 4b79e091..8c602e68 100644 --- a/library/common/templates/lib/ingress/integrations/_traefik.tpl +++ b/library/common/templates/lib/ingress/integrations/_traefik.tpl @@ -102,7 +102,7 @@ {{- end -}} {{/* Format middleware */}} - {{- $formattedMiddlewares = mustAppend $formattedMiddlewares (printf "%s-%s@kubernetescrd" $midNamespace $mid.name ) -}} + {{- $formattedMiddlewares = mustAppend $formattedMiddlewares (printf "%s-%s@kubernetescrd" $midNamespace $mid.name) -}} {{- end -}} {{- if $formattedMiddlewares -}}