Skip to content

Commit

Permalink
fix: handle leading/trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
soniqua committed Jul 15, 2024
1 parent 895d232 commit 9be8240
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/snyk-broker/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ data:
{{- if and .Values.caCert (not .Values.caCertFile) }}
{{ (.Files.Glob .Values.caCert).AsSecrets | nindent 2 }}
{{- else if and .Values.caCertFile (not .Values.caCert) }}
cacert: {{ .Values.caCertFile | b64enc | nindent 4}}
cacert: {{ .Values.caCertFile | trim | b64enc | nindent 4}}
{{- end }}
---
{{- end }}
12 changes: 12 additions & 0 deletions charts/snyk-broker/tests/broker_deployment_ca_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,15 @@ tests:
documentSelector:
path: metadata.name
value: RELEASE-NAME-snyk-broker-cacert-secret

- it: handles extra whitespace
set:
caCertFile: "\n \n-----BEGIN CERTIFICATE-----\nCERTIFICATE GOES HERE\n-----END CERTIFICATE-----\n\n\n"
asserts:
- equal:
path: data.cacert
value: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCkNFUlRJRklDQVRFIEdPRVMgSEVSRQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t
template: secrets.yaml
documentSelector:
path: metadata.name
value: RELEASE-NAME-snyk-broker-cacert-secret

0 comments on commit 9be8240

Please sign in to comment.