From 94bd01944fd8daa683d6803aec5eb4516747f404 Mon Sep 17 00:00:00 2001 From: emmanuelm41 Date: Thu, 26 Oct 2023 10:33:10 -0300 Subject: [PATCH 1/4] allow stringData and encoded values on secrets --- application/Chart.yaml | 2 +- application/templates/secret.yaml | 9 +++- application/tests/secret_test.yaml | 69 ++++++++++++++++++++++++++++++ application/values-test.yaml | 12 ++++++ 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 application/tests/secret_test.yaml diff --git a/application/Chart.yaml b/application/Chart.yaml index e6683ac2..334b0cf7 100644 --- a/application/Chart.yaml +++ b/application/Chart.yaml @@ -6,7 +6,7 @@ type: application # Helm chart Version -version: 2.2.16 +version: 2.3.0 keywords: diff --git a/application/templates/secret.yaml b/application/templates/secret.yaml index 4e58e4bf..be899ca6 100644 --- a/application/templates/secret.yaml +++ b/application/templates/secret.yaml @@ -16,8 +16,13 @@ metadata: {{ toYaml $.Values.secret.annotations | indent 4 }} {{- end }} data: -{{- range $key, $value := $data }} + {{- range $key, $value := .data }} {{ $key }}: {{ $value | b64enc }} -{{- end }} + {{- end }} + {{- with .encodedData }} + {{- toYaml . | nindent 2 }} + {{- end }} +stringData: + {{- toYaml .stringData | nindent 2 }} {{- end }} {{- end }} diff --git a/application/tests/secret_test.yaml b/application/tests/secret_test.yaml new file mode 100644 index 00000000..ea7f7379 --- /dev/null +++ b/application/tests/secret_test.yaml @@ -0,0 +1,69 @@ +suite: Secret + +templates: + - secret.yaml + +tests: + - it: include stringData and data if they are set + set: + secret: + enabled: enable + files: + test: + stringData: + testStringData: testValue + data: + testNoEncodedData: testValue + encodedData: + testEncodedData: dGVzdFZhbHVl + asserts: + - equal: + path: stringData.testStringData + value: testValue + - equal: + path: data.testEncodedData + value: dGVzdFZhbHVl + - equal: + path: data.testNoEncodedData + value: dGVzdFZhbHVl + + - it: include stringData if it is set + set: + secret: + enabled: enable + files: + test: + stringData: + testStringData: testValue + asserts: + - equal: + path: stringData.testStringData + value: testValue + + - it: include data if it is set + set: + secret: + enabled: enable + files: + test: + data: + testNoEncodedData: testValue + asserts: + - equal: + path: data.testNoEncodedData + value: dGVzdFZhbHVl + + + + - it: include encoded data if it is set + set: + secret: + enabled: enable + files: + test: + encodedData: + testEncodedData: dGVzdFZhbHVl + asserts: + - equal: + path: data.testEncodedData + value: dGVzdFZhbHVl diff --git a/application/values-test.yaml b/application/values-test.yaml index 29c795a2..fa8c0a06 100644 --- a/application/values-test.yaml +++ b/application/values-test.yaml @@ -479,10 +479,22 @@ secret: # data: # secretKey1: secretValue1 # secretKey2: secretValue2 +# encodedData: +# secretKey3: c2VjcmV0VmFsdWUx +# secretKey4: c2VjcmV0VmFsdWUy +# stringData: +# secretKey5: secretValue1 +# secretKey6: secretValue2 # password: # data: # secretKey1: secretValue1 # secretKey2: secretValue2 +# encodedData: +# secretKey3: c2VjcmV0VmFsdWUx +# secretKey4: c2VjcmV0VmFsdWUy +# stringData: +# secretKey5: secretValue1 +# secretKey6: secretValue2 # Service Monitor to collect Prometheus metrices serviceMonitor: From 549850785645e4cb2039042472453ec3a04fa6ef Mon Sep 17 00:00:00 2001 From: emmanuelm41 Date: Fri, 15 Dec 2023 09:02:57 -0300 Subject: [PATCH 2/4] leave chart version untouched by commits #minor --- application/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/Chart.yaml b/application/Chart.yaml index 334b0cf7..e6683ac2 100644 --- a/application/Chart.yaml +++ b/application/Chart.yaml @@ -6,7 +6,7 @@ type: application # Helm chart Version -version: 2.3.0 +version: 2.2.16 keywords: From 09d503909a93fdd000dca09dd8c182e1b31cdb0e Mon Sep 17 00:00:00 2001 From: emmanuelm41 Date: Fri, 15 Dec 2023 09:10:00 -0300 Subject: [PATCH 3/4] add docs on readme and changelog --- CHANGELOG.md | 3 +++ README.md | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fed4007d..78b7e466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented here. +### v2.3.0 +- Feature: allow multiple provided text types on secret creation: stringData, data and encodedData [PR-282](https://github.com/stakater/application/pull/282) + ### v2.2.6 - fix: allow multiple cronjobs [PR-271](https://github.com/stakater/application/pull/271) diff --git a/README.md b/README.md index db37d009..1665c054 100644 --- a/README.md +++ b/README.md @@ -269,21 +269,24 @@ Stakater [Forecastle](https://github.com/stakater/Forecastle) parameters ### ConfigMap Paramaters -| Name | Description | Value | -| ------------------------ | -------------------------------------------------------------------------------------------- | --------------- | -| configMap.enabled | Enable configMaps | `false` | -| configMap.additionalLabels | Labels for configMaps | `{}` | -| configMap.annotations | Annotations for configMaps | `{}` | -| configMap.files | Map of configMap files with suffixes and data contained in those files | `{}` | +| Name | Description | Value | +|----------------------------|------------------------------------------------------------------------------------|----------------| +| configMap.enabled | Enable configMaps | `false` | +| configMap.additionalLabels | Labels for configMaps | `{}` | +| configMap.annotations | Annotations for configMaps | `{}` | +| configMap.files | Map of configMap files with suffixes and data contained in those files | `{}` | ### Secret Paramaters -| Name | Description | Value | -| ------------------------ | -------------------------------------------------------------------------------------------- | --------------- | -| secret.enabled | Enable secret | `false` | -| secret.additionalLabels | Labels for secret | `{}` | -| secret.annotations | Annotations for secret | `{}` | -| secret.files | Map of secret files with suffixes and data contained in those files | `{}` | +| Name | Description | Value | +|---------------------------------|---------------------------------------------------------------------------------|------------------------| +| secret.enabled | Enable secret | `false` | +| secret.additionalLabels | Labels for secret | `{}` | +| secret.annotations | Annotations for secret | `{}` | +| secret.files | Map of secret files with suffixes and data contained in those files | `{}` | +| secret.files.[name].stringData | Allow to provide the clear text content inside the secret | `{}` | +| secret.files.[name].data | Allow to provide the text content inside the secret that will be base64 encoded | `{}` | +| secret.files.[name].encodedData | Allow to provide the text content inside the secret already base64 encoded | `{}` | ### ServiceMonitor Paramaters From 5088b3887088fe71eb0d57c498a87e4edadc7c09 Mon Sep 17 00:00:00 2001 From: emmanuelm41 Date: Wed, 27 Dec 2023 09:22:21 -0300 Subject: [PATCH 4/4] add commented values on values.yaml --- application/values.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/values.yaml b/application/values.yaml index ccb91391..8993952b 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -570,6 +570,14 @@ secret: # data: # secretKey1: secretValue1 # secretKey2: secretValue2 +# apiKey: +# stringData: +# secretKey1: secretValue1 +# secretKey2: secretValue2 +# secondApiKeu: +# encodedData: +# secretKey1: dGVzdFZhbHVl +# secretKey2: dGVzdFZhbHVl ########################################################## # Service Monitor to collect Prometheus metrices