Skip to content

Commit 3691de6

Browse files
authored
feat: Allow setting SEQ_FIRSTRUN_ADMINPASSWORD and SEQ_FIRSTRUN_ADMINPASSWORDHASHa from Secret (#65)
If `firstRunAdminPasswordSecret` or `firstRunAdminPasswordHashSecret` object is defined with `name` of existing Kubernetes secret and its data `key`, then `envFrom` is used to define the container environment variable with password or password hash value retrieved from the given secret key. Closes #64 Signed-off-by: Mateusz Łoskot <[email protected]>
1 parent 2101683 commit 3691de6

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

charts/seq/templates/deployment.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,27 @@ spec:
3939
- name: "SEQ_FIRSTRUN_ADMINUSERNAME"
4040
value: "{{ .Values.firstRunAdminUsername }}"
4141
{{- end }}
42-
{{- if .Values.firstRunAdminPassword }}
42+
{{- if or .Values.firstRunAdminPassword .Values.firstRunAdminPasswordSecret }}
4343
- name: "SEQ_FIRSTRUN_ADMINPASSWORD"
44+
{{- if .Values.firstRunAdminPassword }}
4445
value: "{{ .Values.firstRunAdminPassword }}"
46+
{{- else }}
47+
valueFrom:
48+
secretKeyRef:
49+
name: {{ required "A valud .Values.firstRunAdminPasswordSecret.name is required" .Values.firstRunAdminPasswordSecret.name | quote }}
50+
key: {{ required "A valud .Values.firstRunAdminPasswordSecret.key is required" .Values.firstRunAdminPasswordSecret.key | quote }}
4551
{{- end }}
46-
{{- if .Values.firstRunAdminPasswordHash }}
52+
{{- end }}
53+
{{- if or .Values.firstRunAdminPasswordHash .Values.firstRunAdminPasswordHashSecret }}
4754
- name: "SEQ_FIRSTRUN_ADMINPASSWORDHASH"
55+
{{- if .Values.firstRunAdminPasswordHash }}
4856
value: "{{ .Values.firstRunAdminPasswordHash }}"
57+
{{- else }}
58+
valueFrom:
59+
secretKeyRef:
60+
name: {{ required "A valud .Values.firstRunAdminPasswordHashSecret.name is required" .Values.firstRunAdminPasswordHashSecret.name | quote }}
61+
key: {{ required "A valud .Values.firstRunAdminPasswordHashSecret.key is required" .Values.firstRunAdminPasswordHashSecret.key | quote }}
62+
{{- end }}
4963
{{- end }}
5064
{{- if .Values.firstRunRequireAuthenticationForHttpIngestion }}
5165
- name: "SEQ_FIRSTRUN_REQUIREAUTHENTICATIONFORHTTPINGESTION"
@@ -180,6 +194,6 @@ spec:
180194

181195
# At least one of the default password variables must be set; note that this ignores SEQ_PASSWORD, but
182196
# that variable is just a convenience alias for SEQ_FIRSTRUN_ADMINPASSWORD anyway.
183-
{{- if not (or .Values.firstRunNoAuthentication .Values.firstRunAdminPassword .Values.firstRunAdminPasswordHash) }}
184-
{{- fail "One of firstRunAdminPassword or firstRunAdminPasswordHash must be specified." }}
197+
{{- if not (or .Values.firstRunNoAuthentication .Values.firstRunAdminPassword .Values.firstRunAdminPasswordHash .Values.firstRunAdminPasswordSecret .Values.firstRunAdminPasswordHashSecret) }}
198+
{{- fail "One of firstRunAdminPassword or firstRunAdminPasswordHash or firstRunAdminPasswordSecret or firstRunAdminPasswordHashSecret must be specified." }}
185199
{{- end }}

charts/seq/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,22 @@ acceptEULA: "Y"
2020
# deployment). See the `firstRunAdminPasswordHash` variant below for better confidentiality.
2121
firstRunNoAuthentication: false
2222
# firstRunAdminPassword: ""
23+
#
24+
# Alternatively, a default admin password can be provided from Kubernetes secret:
25+
# firstRunAdminPasswordSecret:
26+
# name: "seq-admin-password-secret"
27+
# key: "password"
2328

2429
# Further customization of the default security settings.
2530
# See here for docs on how to create a password hash: https://blog.datalust.co/setting-an-initial-password-when-deploying-seq-to-docker/
2631
# firstRunAdminUsername: "admin"
2732
# firstRunAdminPasswordHash: ""
2833
# firstRunRequireAuthenticationForHttpIngestion: true
34+
#
35+
# Alternatively, a password hash can be provided from Kubernetes secret:
36+
# firstRunAdminPasswordHashSecret:
37+
# name: "seq-admin-password-hash-secret"
38+
# key: "password"
2939

3040
# Set this URL if you enable ingress and/or AAD authentication.
3141
# Without this URL set to include HTTPS, Seq will try to set a login redirect

0 commit comments

Comments
 (0)