From 8ee9061c71b17f4e5ead306ebde06a9c00705dcf Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Sun, 28 Apr 2024 21:25:57 +0200 Subject: [PATCH] fix(credentials): allow credentials to be defined as credentialsList (#795) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** We want credentials as a List in SCALE, obviously. **โš™๏ธ Type of change** - [x] โš™๏ธ 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?** **๐Ÿ“ƒ Notes:** **โœ”๏ธ Checklist:** - [ ] โš–๏ธ My code follows the style guidelines of this project - [ ] ๐Ÿ‘€ 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 - [ ] โš ๏ธ My changes generate no new warnings - [ ] ๐Ÿงช I have added tests to this description that prove my fix is effective or that my feature works - [ ] โฌ†๏ธ I increased versions for any altered app according to semantic versioning - [ ] 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._ --- .../common-test/ci/credentials-values.yaml | 48 +++++++++++++++++++ .../ci/credentialsList-values.yaml | 48 +++++++++++++++++++ library/common/Chart.yaml | 2 +- library/common/templates/loader/_lists.tpl | 6 +-- .../lists/_backupStorageLocationList.tpl | 18 ------- .../values/lists/_credentialsList.tpl | 18 +++++++ .../templates/values/lists/_scheduleList.tpl | 18 ------- .../lists/_volumeSnapshotLocationList.tpl | 18 ------- 8 files changed, 116 insertions(+), 60 deletions(-) create mode 100644 library/common-test/ci/credentials-values.yaml create mode 100644 library/common-test/ci/credentialsList-values.yaml delete mode 100644 library/common/templates/values/lists/_backupStorageLocationList.tpl create mode 100644 library/common/templates/values/lists/_credentialsList.tpl delete mode 100644 library/common/templates/values/lists/_scheduleList.tpl delete mode 100644 library/common/templates/values/lists/_volumeSnapshotLocationList.tpl diff --git a/library/common-test/ci/credentials-values.yaml b/library/common-test/ci/credentials-values.yaml new file mode 100644 index 00000000..4ee0db84 --- /dev/null +++ b/library/common-test/ci/credentials-values.yaml @@ -0,0 +1,48 @@ +service: + main: + enabled: true + primary: true + ports: + main: + enabled: true + primary: true + protocol: http + port: 8080 + +workload: + main: + enabled: true + primary: true + type: Deployment + podSpec: + containers: + main: + enabled: true + primary: true + args: + - --port + - "8080" + probes: + liveness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + readiness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + startup: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + + +credentials: + mys3: + type: s3 + url: "" + region: "" + bucket: "" + accessKey: "" + secretKey: "" + encrKey: "" diff --git a/library/common-test/ci/credentialsList-values.yaml b/library/common-test/ci/credentialsList-values.yaml new file mode 100644 index 00000000..aa1ea290 --- /dev/null +++ b/library/common-test/ci/credentialsList-values.yaml @@ -0,0 +1,48 @@ +service: + main: + enabled: true + primary: true + ports: + main: + enabled: true + primary: true + protocol: http + port: 8080 + +workload: + main: + enabled: true + primary: true + type: Deployment + podSpec: + containers: + main: + enabled: true + primary: true + args: + - --port + - "8080" + probes: + liveness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + readiness: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + startup: + enabled: true + type: http + port: "{{ .Values.service.main.ports.main.port }}" + + +credentials: + - name: mys3 + type: s3 + url: "" + region: "" + bucket: "" + accessKey: "" + secretKey: "" + encrKey: "" diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 014c513b..65627a3e 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,7 +15,7 @@ maintainers: name: common sources: null type: library -version: 21.0.0 +version: 21.0.1 annotations: artifacthub.io/category: "integration-delivery" artifacthub.io/license: "BUSL-1.1" diff --git a/library/common/templates/loader/_lists.tpl b/library/common/templates/loader/_lists.tpl index 680512b3..8595a22e 100644 --- a/library/common/templates/loader/_lists.tpl +++ b/library/common/templates/loader/_lists.tpl @@ -10,14 +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" . -}} {{- include "tc.v1.common.values.volumeSnapshotClassList" . -}} - {{- include "tc.v1.common.values.schedulesList" . -}} + {{- include "tc.v1.common.values.credentialsList" . -}} {{- end -}} diff --git a/library/common/templates/values/lists/_backupStorageLocationList.tpl b/library/common/templates/values/lists/_backupStorageLocationList.tpl deleted file mode 100644 index 50b4bb4e..00000000 --- a/library/common/templates/values/lists/_backupStorageLocationList.tpl +++ /dev/null @@ -1,18 +0,0 @@ -{{- define "tc.v1.common.values.backupStorageLocationList" -}} - {{- $rootCtx := . -}} - - {{- range $idx, $bslValues := $rootCtx.Values.backupStorageLocationList -}} - - {{- $name := (printf "bsl-list-%s" (toString $idx)) -}} - - {{- with $bslValues.name -}} - {{- $name = . -}} - {{- end -}} - - {{- if not (hasKey $rootCtx.Values "backupStorageLocation") -}} - {{- $_ := set $rootCtx.Values "backupStorageLocation" dict -}} - {{- end -}} - - {{- $_ := set $rootCtx.Values.backupStorageLocation $name $bslValues -}} - {{- end -}} -{{- end -}} diff --git a/library/common/templates/values/lists/_credentialsList.tpl b/library/common/templates/values/lists/_credentialsList.tpl new file mode 100644 index 00000000..7464dc25 --- /dev/null +++ b/library/common/templates/values/lists/_credentialsList.tpl @@ -0,0 +1,18 @@ +{{- define "tc.v1.common.values.credentialsList" -}} + {{- $rootCtx := . -}} + + {{- range $idx, $credsValues := $rootCtx.Values.credentialsList -}} + + {{- $name := (printf "vs-list-%s" (toString $idx)) -}} + + {{- with $credsValues.name -}} + {{- $name = . -}} + {{- end -}} + + {{- if not (hasKey $rootCtx.Values "credentials") -}} + {{- $_ := set $rootCtx.Values "credentials" dict -}} + {{- end -}} + + {{- $_ := set $rootCtx.Values.credentials $name $credsValues -}} + {{- end -}} +{{- end -}} diff --git a/library/common/templates/values/lists/_scheduleList.tpl b/library/common/templates/values/lists/_scheduleList.tpl deleted file mode 100644 index 651f998d..00000000 --- a/library/common/templates/values/lists/_scheduleList.tpl +++ /dev/null @@ -1,18 +0,0 @@ -{{- define "tc.v1.common.values.schedulesList" -}} - {{- $rootCtx := . -}} - - {{- range $idx, $scheduleValues := $rootCtx.Values.schedulesList -}} - - {{- $name := (printf "schedules-list-%s" (toString $idx)) -}} - - {{- with $scheduleValues.name -}} - {{- $name = . -}} - {{- end -}} - - {{- if not (hasKey $rootCtx.Values "schedules") -}} - {{- $_ := set $rootCtx.Values "schedules" dict -}} - {{- end -}} - - {{- $_ := set $rootCtx.Values.schedules $name $scheduleValues -}} - {{- end -}} -{{- end -}} diff --git a/library/common/templates/values/lists/_volumeSnapshotLocationList.tpl b/library/common/templates/values/lists/_volumeSnapshotLocationList.tpl deleted file mode 100644 index d264e741..00000000 --- a/library/common/templates/values/lists/_volumeSnapshotLocationList.tpl +++ /dev/null @@ -1,18 +0,0 @@ -{{- define "tc.v1.common.values.volumeSnapshotLocationList" -}} - {{- $rootCtx := . -}} - - {{- range $idx, $vslValues := $rootCtx.Values.volumeSnapshotLocationList -}} - - {{- $name := (printf "vs-list-%s" (toString $idx)) -}} - - {{- with $vslValues.name -}} - {{- $name = . -}} - {{- end -}} - - {{- if not (hasKey $rootCtx.Values "volumeSnapshotLocation") -}} - {{- $_ := set $rootCtx.Values "volumeSnapshotLocation" dict -}} - {{- end -}} - - {{- $_ := set $rootCtx.Values.volumeSnapshotLocation $name $vslValues -}} - {{- end -}} -{{- end -}}