diff --git a/charts/onechart/templates/deployment.yaml b/charts/onechart/templates/deployment.yaml index 445bd0e..e9e7591 100644 --- a/charts/onechart/templates/deployment.yaml +++ b/charts/onechart/templates/deployment.yaml @@ -43,9 +43,9 @@ spec: - configMapRef: name: {{ template "robustName" .Release.Name }} {{- end }} - {{- if .Values.secret.enabled }} + {{- if .Values.secretEnabled }} - secretRef: - name: {{ template "robustName" .Release.Name }} + name: {{ .Values.secretName | default (include "robustName" $.Release.Name) }} {{- end }} {{- if .Values.sealedSecrets }} - secretRef: diff --git a/charts/onechart/tests/deployment_secret_test.yaml b/charts/onechart/tests/deployment_secret_test.yaml index a65324f..b4256fe 100644 --- a/charts/onechart/tests/deployment_secret_test.yaml +++ b/charts/onechart/tests/deployment_secret_test.yaml @@ -5,7 +5,7 @@ templates: tests: - it: Should reference secret if secret is enabled set: - secret.enabled: true + secretEnabled: true asserts: - contains: path: spec.template.spec.containers[0].envFrom @@ -14,10 +14,20 @@ tests: name: release-name - it: Should not reference secret if secret is disabled set: - secret.enabled: false + 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: + path: spec.template.spec.containers[0].envFrom + content: + secretRef: + name: my-custom-secret - it: Should reference secret if sealedSecrets is set set: sealedSecrets: diff --git a/charts/onechart/values.yaml b/charts/onechart/values.yaml index 06e1759..da8b4b6 100644 --- a/charts/onechart/values.yaml +++ b/charts/onechart/values.yaml @@ -40,8 +40,7 @@ probe: timeoutSeconds: 3 failureThreshold: 3 -secret: - enabled: false +secretEnabled: false shell: "/bin/sh"