-
-
Notifications
You must be signed in to change notification settings - Fork 61
feat: Add support for existingSecret for htpasswd authentication #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,7 +32,12 @@ spec: | |||||||||||||
| metadata: | ||||||||||||||
| annotations: | ||||||||||||||
| checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} | ||||||||||||||
| {{- if and .Values.secrets.htpasswd (not .Values.secrets.existingSecretHtpasswd) }} | ||||||||||||||
| checksum/htpasswd-secret: {{ toJson .Values.secrets.htpasswd | sha256sum }} | ||||||||||||||
| {{- end }} | ||||||||||||||
| {{- if .Values.secrets.existingSecretHtpasswd }} | ||||||||||||||
| checksum/htpasswd-secret: {{ .Values.secrets.existingSecretHtpasswd }}-{{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }} | ||||||||||||||
| {{- end }} | ||||||||||||||
| {{- if .Values.secretEnvVars }} | ||||||||||||||
| checksum/env-secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} | ||||||||||||||
| {{- end }} | ||||||||||||||
|
|
@@ -129,10 +134,10 @@ spec: | |||||||||||||
| - mountPath: /verdaccio/storage | ||||||||||||||
| name: storage | ||||||||||||||
| readOnly: false | ||||||||||||||
| {{- if .Values.secrets.htpasswd }} | ||||||||||||||
| {{- if or .Values.secrets.htpasswd .Values.secrets.existingSecretHtpasswd }} | ||||||||||||||
| - mountPath: /verdaccio/storage/htpasswd | ||||||||||||||
| name: htpasswd | ||||||||||||||
| subPath: htpasswd | ||||||||||||||
| subPath: {{ if .Values.secrets.existingSecretHtpasswd }}{{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }}{{ else }}htpasswd{{ end }} | ||||||||||||||
|
||||||||||||||
| subPath: {{ if .Values.secrets.existingSecretHtpasswd }}{{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }}{{ else }}htpasswd{{ end }} | |
| subPath: {{- if .Values.secrets.existingSecretHtpasswd }} | |
| {{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }} | |
| {{- else }} | |
| htpasswd | |
| {{- end }} |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline conditional for secretName makes the template harder to read. Consider moving this logic to a helper template or using a clearer multi-line if-else structure for better maintainability.
| secretName: {{ if .Values.secrets.existingSecretHtpasswd }}{{ .Values.secrets.existingSecretHtpasswd }}{{ else }}{{ include "verdaccio.fullname" . }}-htpasswd{{ end }} | |
| {{- if .Values.secrets.existingSecretHtpasswd }} | |
| secretName: {{ .Values.secrets.existingSecretHtpasswd }} | |
| {{- else }} | |
| secretName: {{ include "verdaccio.fullname" . }}-htpasswd | |
| {{- end }} |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,7 +25,12 @@ spec: | |||||||||||||
| metadata: | ||||||||||||||
| annotations: | ||||||||||||||
| checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} | ||||||||||||||
| {{- if and .Values.secrets.htpasswd (not .Values.secrets.existingSecretHtpasswd) }} | ||||||||||||||
| checksum/htpasswd-secret: {{ toJson .Values.secrets.htpasswd | sha256sum }} | ||||||||||||||
| {{- end }} | ||||||||||||||
| {{- if .Values.secrets.existingSecretHtpasswd }} | ||||||||||||||
| checksum/htpasswd-secret: {{ .Values.secrets.existingSecretHtpasswd }}-{{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }} | ||||||||||||||
| {{- end }} | ||||||||||||||
|
Comment on lines
+31
to
+33
|
||||||||||||||
| {{- if .Values.secrets.existingSecretHtpasswd }} | |
| checksum/htpasswd-secret: {{ .Values.secrets.existingSecretHtpasswd }}-{{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }} | |
| {{- end }} |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline conditional for subPath makes the template harder to read. Consider moving this logic to a helper template or using a clearer multi-line if-else structure for better maintainability.
| subPath: {{ if .Values.secrets.existingSecretHtpasswd }}{{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }}{{ else }}htpasswd{{ end }} | |
| {{- if .Values.secrets.existingSecretHtpasswd }} | |
| subPath: {{ .Values.secrets.existingSecretHtpasswdKey | default "htpasswd" }} | |
| {{- else }} | |
| subPath: htpasswd | |
| {{- end }} |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline conditional for secretName makes the template harder to read. Consider moving this logic to a helper template or using a clearer multi-line if-else structure for better maintainability.
| secretName: {{ if .Values.secrets.existingSecretHtpasswd }}{{ .Values.secrets.existingSecretHtpasswd }}{{ else }}{{ include "verdaccio.fullname" . }}-htpasswd{{ end }} | |
| {{- if .Values.secrets.existingSecretHtpasswd }} | |
| secretName: {{ .Values.secrets.existingSecretHtpasswd }} | |
| {{- else }} | |
| secretName: {{ include "verdaccio.fullname" . }}-htpasswd | |
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checksum annotation for existingSecretHtpasswd only concatenates the secret name and key, which won't detect changes to the actual secret content. This means pods won't automatically restart when the external secret is updated. Consider documenting that users need to manually trigger pod restarts when updating the external secret, or remove this checksum annotation entirely since Kubernetes doesn't automatically track changes to external secrets.