Skip to content

Commit 3e5d77d

Browse files
committed
Fixed chart bugs
- Fixed a bug found in pull request twuni#185 where if an existing secret was defined, its data wasn't mounted to the deployment and env vars referencing to the auth credentials location inside containers were not created - Fixed multiple whitespace and indenation issues during templating when specifying custom fields for existing secrets
1 parent 2dc3fca commit 3e5d77d

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

templates/_helpers.tpl

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
5353
secretKeyRef:
5454
name: {{ template "docker-registry.secretName" . }}
5555
{{- if and .Values.secrets.haSharedSecretKey .Values.secrets.existingSecret }}
56-
key: {{- .Values.secrets.haSharedSecretKey }}
56+
key: {{ .Values.secrets.haSharedSecretKey }}
5757
{{- else }}
5858
key: haSharedSecret
5959
{{- end }}
60-
{{- end }}
6160

6261
{{- if .Values.secrets.htpasswd }}
6362
- name: REGISTRY_AUTH
@@ -161,20 +160,20 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
161160
valueFrom:
162161
secretKeyRef:
163162
name: {{ template "docker-registry.swiftSecretName" . }}
164-
{{- if and .Values.secrets.swift.usernameKey .Values.secrets.swift.secretRef -}}
165-
key: {{- .Values.secrets.swift.usernameKey -}}
166-
{{- else -}}
163+
{{- if and .Values.secrets.swift.usernameKey .Values.secrets.swift.secretRef }}
164+
key: {{ .Values.secrets.swift.usernameKey }}
165+
{{- else }}
167166
key: swiftUsername
168-
{{- end -}}
167+
{{- end }}
169168
- name: REGISTRY_STORAGE_SWIFT_PASSWORD
170169
valueFrom:
171170
secretKeyRef:
172171
name: {{ template "docker-registry.swiftSecretName" . }}
173-
{{- if and .Values.secrets.swift.passwordKey .Values.secrets.swift.secretRef -}}
174-
key: {{- .Values.secrets.swift.passwordKey -}}
175-
{{- else -}}
172+
{{- if and .Values.secrets.swift.passwordKey .Values.secrets.swift.secretRef }}
173+
key: {{ .Values.secrets.swift.passwordKey }}
174+
{{- else }}
176175
key: swiftPassword
177-
{{- end -}}
176+
{{- end }}
178177
- name: REGISTRY_STORAGE_SWIFT_CONTAINER
179178
value: {{ required ".Values.swift.container is required" .Values.swift.container }}
180179
{{- end -}}
@@ -186,20 +185,20 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
186185
valueFrom:
187186
secretKeyRef:
188187
name: {{ if .Values.proxy.secretRef }}{{ .Values.proxy.secretRef }}{{ else }}{{ template "docker-registry.secretName" . }}{{ end }}
189-
{{- if and .Values.proxy.proxyUsernameKey .Values.proxy.secretRef -}}
190-
key: {{- .Values.proxy.proxyUsernameKey -}}
191-
{{- else -}}
188+
{{- if and .Values.proxy.proxyUsernameKey .Values.proxy.secretRef }}
189+
key: {{ .Values.proxy.proxyUsernameKey }}
190+
{{- else }}
192191
key: proxyUsername
193-
{{- end -}}
192+
{{- end }}
194193
- name: REGISTRY_PROXY_PASSWORD
195194
valueFrom:
196195
secretKeyRef:
197196
name: {{ if .Values.proxy.secretRef }}{{ .Values.proxy.secretRef }}{{ else }}{{ template "docker-registry.secretName" . }}{{ end }}
198-
{{- if and .Values.proxy.proxyPasswordKey .Values.proxy.secretRef -}}
199-
key: {{- .Values.proxy.proxyPasswordKey -}}
200-
{{- else -}}
197+
{{- if and .Values.proxy.proxyPasswordKey .Values.proxy.secretRef }}
198+
key: {{ .Values.proxy.proxyPasswordKey }}
199+
{{- else }}
201200
key: proxyPassword
202-
{{- end -}}
201+
{{- end }}
203202
{{- end -}}
204203

205204
{{- if .Values.persistence.deleteEnabled }}
@@ -211,11 +210,13 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
211210
{{ toYaml . }}
212211
{{- end -}}
213212

213+
{{- end }}
214+
214215
{{- define "docker-registry.volumeMounts" -}}
215216
- name: "{{ template "docker-registry.fullname" . }}-config"
216217
mountPath: {{ .Values.configPath }}
217218

218-
{{- if .Values.secrets.htpasswd }}
219+
{{- if or .Values.secrets.htpasswd .Values.secrets.existingSecret }}
219220
- name: auth
220221
mountPath: /auth
221222
readOnly: true
@@ -243,13 +244,13 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
243244
configMap:
244245
name: {{ template "docker-registry.fullname" . }}-config
245246

246-
{{- if .Values.secrets.htpasswd }}
247+
{{- if or .Values.secrets.htpasswd .Values.secrets.existingSecret }}
247248
- name: auth
248249
secret:
249250
secretName: {{ template "docker-registry.secretName" . }}
250251
items:
251252
{{- if and .Values.secrets.htpasswdKey .Values.secrets.existingSecret }}
252-
- key: {{- .Values.secrets.htpasswdKey }}
253+
- key: {{ .Values.secrets.htpasswdKey }}
253254
path: htpasswd
254255
{{- else }}
255256
- key: htpasswd

templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
{{- end }}
3333
annotations:
3434
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
35-
{{- if not .Values.existingSecret }}
35+
{{- if not .Values.secrets.existingSecret }}
3636
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
3737
{{- end }}
3838
{{- if .Values.podAnnotations }}

0 commit comments

Comments
 (0)