diff --git a/application/Chart.yaml b/application/Chart.yaml index a458ef6c..334b0cf7 100644 --- a/application/Chart.yaml +++ b/application/Chart.yaml @@ -6,7 +6,7 @@ type: application # Helm chart Version -version: 2.2.11 +version: 2.3.0 keywords: diff --git a/application/templates/secret.yaml b/application/templates/secret.yaml index 08636ae3..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 80013c92..44bc128e 100644 --- a/application/values-test.yaml +++ b/application/values-test.yaml @@ -476,10 +476,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: