diff --git a/charts/dex/Chart.yaml b/charts/dex/Chart.yaml index 70bf26df..a4b88629 100644 --- a/charts/dex/Chart.yaml +++ b/charts/dex/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 type: application name: dex -version: 0.14.0 +version: 0.15.0 appVersion: "2.36.0" kubeVersion: ">=1.14.0-0" description: OpenID Connect (OIDC) identity and OAuth 2.0 provider with pluggable connectors. @@ -22,7 +22,7 @@ maintainers: annotations: artifacthub.io/changes: | - kind: added - description: "Common labels to all resources created by the chart" + description: "Added volumes and volumeMounts helpers to only mount secret if a secret is needed" artifacthub.io/images: | - name: dex image: ghcr.io/dexidp/dex:v2.36.0 diff --git a/charts/dex/templates/_helpers.tpl b/charts/dex/templates/_helpers.tpl index 5ca8115f..d6e7ca26 100644 --- a/charts/dex/templates/_helpers.tpl +++ b/charts/dex/templates/_helpers.tpl @@ -74,3 +74,27 @@ Create the name of the secret containing the config file to use {{- default "default" .Values.configSecret.name }} {{- end }} {{- end }} + +{{/* +Create Volumes +*/}} +{{- define "dex.volumes" -}} +{{- if or .Values.configSecret.create .Values.configSecret.name }} +{{- $defaultVolume := list (dict "name" "config" "secret" (dict "secretName" (include "dex.configSecretName" .))) -}} +{{ concat $defaultVolume .Values.volumes | toYaml }} +{{- else -}} +{{ .Values.volumes | toYaml }} +{{- end }} +{{- end }} + +{{/* +Create Volume Mounts +*/}} +{{- define "dex.volumeMounts" -}} +{{- if or .Values.configSecret.create .Values.configSecret.name }} +{{- $defaultMount := list (dict "name" "config" "mountPath" "/etc/dex" "readOnly" "true") -}} +{{ concat $defaultMount .Values.volumeMounts | toYaml }} +{{- else -}} +{{ .Values.volumeMounts | toYaml }} +{{- end }} +{{- end }} diff --git a/charts/dex/templates/deployment.yaml b/charts/dex/templates/deployment.yaml index 1f3ad4b8..673ea72b 100644 --- a/charts/dex/templates/deployment.yaml +++ b/charts/dex/templates/deployment.yaml @@ -103,19 +103,9 @@ spec: resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - - name: config - mountPath: /etc/dex - readOnly: true - {{- with .Values.volumeMounts }} - {{- toYaml . | nindent 12 }} - {{- end }} + {{- (include "dex.volumeMounts" .) | nindent 12 }} volumes: - - name: config - secret: - secretName: {{ include "dex.configSecretName" . }} - {{- with .Values.volumes }} - {{- toYaml . | nindent 8 }} - {{- end }} + {{- (include "dex.volumes" .) | nindent 8 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }}