chore(credentials): expand checks (#828)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  #813

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [x] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [x] ⚠️ My changes generate no new warnings
- [x] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [x] ⬆️ I increased versions for any altered app according to semantic
versioning
- [x] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
This commit is contained in:
Stavros Kois
2024-06-09 11:30:01 +03:00
committed by GitHub
parent 695f3d7e5c
commit 7758f93fdb
4 changed files with 37 additions and 2 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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) -}}

View File

@@ -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 -}}