Skip to content

Commit

Permalink
Supporting secretName without secretEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Aug 2, 2021
1 parent ade37a8 commit ae6c219
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
8 changes: 6 additions & 2 deletions charts/onechart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,19 @@ spec:
- -c
- {{ .Values.command | quote }}
{{- end }}
{{- if or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets }}
{{- if or (or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets) .Values.secretName }}
envFrom: &envFrom
{{- if .Values.vars }}
- configMapRef:
name: {{ template "robustName" .Release.Name }}
{{- end }}
{{- if .Values.secretEnabled }}
- secretRef:
name: {{ .Values.secretName | default (include "robustName" $.Release.Name) }}
name: {{ include "robustName" $.Release.Name }}
{{- end }}
{{- if .Values.secretName }}
- secretRef:
name: {{ .Values.secretName }}
{{- end }}
{{- if .Values.sealedSecrets }}
- secretRef:
Expand Down
9 changes: 1 addition & 8 deletions charts/onechart/tests/deployment_secret_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@ tests:
content:
secretRef:
name: release-name
- it: Should not reference secret if secret is disabled
- it: Should reference secret by name
set:
secretEnabled: false
asserts:
- isNull:
path: spec.template.spec.containers[0].envFrom
- it: Should not reference secret if secret is disabled
set:
secretEnabled: true
secretName: my-custom-secret
asserts:
- contains:
Expand Down

0 comments on commit ae6c219

Please sign in to comment.