Skip to content

Commit

Permalink
[Helm] Use hash trick to restart on config/creds changes
Browse files Browse the repository at this point in the history
  • Loading branch information
meln5674 committed Oct 7, 2022
1 parent 8361005 commit f87dc94
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
10 changes: 7 additions & 3 deletions deploy/helm/nexus-oidc-proxy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{{- define "nexus-oidc-proxy.configMapContents" -}}
data:
'{{ .Values.config.existingConfigMap.key }}': |-
{{- .Values.config.yaml | toYaml | nindent 4 }}
{{- end -}}

{{- if not .Values.config.existingConfigMap.name }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "nexus-oidc-proxy.configMapName" . }}
labels:
{{ include "nexus-oidc-proxy.labels" . | nindent 4 }}
data:
'{{ .Values.config.existingConfigMap.key }}': |-
{{- .Values.config.yaml | toYaml | nindent 4 }}
{{ include "nexus-oidc-proxy.configMapContents" . }}
{{- end }}
6 changes: 6 additions & 0 deletions deploy/helm/nexus-oidc-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ spec:
{{- end }}
labels:
{{- include "nexus-oidc-proxy.selectorLabels" . | nindent 8 }}
{{- if not .Values.credentials.existingSecret.name }}
nexus-oidc-proxy/secret-hash: {{ include "nexus-oidc-proxy.secretContents" . | adler32sum }}
{{- end }}
{{- if not .Values.config.existingConfigMap.name }}
nexus-oidc-proxy/configmap-hash: {{ include "nexus-oidc-proxy.configMapContents" . | adler32sum }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
10 changes: 7 additions & 3 deletions deploy/helm/nexus-oidc-proxy/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{{- define "nexus-oidc-proxy.secretContents" -}}
stringData:
'{{ .Values.credentials.existingSecret.usernameKey }}': '{{ .Values.credentials.username }}'
'{{ .Values.credentials.existingSecret.passwordKey }}': '{{ .Values.credentials.password }}'
{{- end -}}

{{- if not .Values.credentials.existingSecret.name }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "nexus-oidc-proxy.secretName" . }}
labels:
{{ include "nexus-oidc-proxy.labels" . | nindent 4 }}
stringData:
'{{ .Values.credentials.existingSecret.usernameKey }}': '{{ .Values.credentials.username }}'
'{{ .Values.credentials.existingSecret.passwordKey }}': '{{ .Values.credentials.password }}'
{{ include "nexus-oidc-proxy.secretContents" . }}
{{- end }}

0 comments on commit f87dc94

Please sign in to comment.