Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow stringData or encodedData on secrets #282

Merged
merged 4 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
allow stringData and encoded values on secrets
  • Loading branch information
emmanuelm41 committed Dec 15, 2023
commit 94bd01944fd8daa683d6803aec5eb4516747f404
2 changes: 1 addition & 1 deletion application/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type: application

# Helm chart Version

version: 2.2.16
version: 2.3.0
emmanuelm41 marked this conversation as resolved.
Show resolved Hide resolved


keywords:
Expand Down
9 changes: 7 additions & 2 deletions application/templates/secret.yaml
d3adb5 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
69 changes: 69 additions & 0 deletions application/tests/secret_test.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions application/values-test.yaml
emmanuelm41 marked this conversation as resolved.
Show resolved Hide resolved
emmanuelm41 marked this conversation as resolved.
Show resolved Hide resolved
emmanuelm41 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading