Skip to content

Commit db4d3f2

Browse files
committed
ensure st2.password/st2.ssh_key always override the current value
1 parent 91041e7 commit db4d3f2

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

templates/secrets_ssh.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ metadata:
2121
type: Opaque
2222
data:
2323
# SSH private key for the 'stanley' system user ('system_user.ssh_key_file' in st2.conf).
24-
{{- if .Release.IsUpgrade }}
25-
private_key: {{ index (lookup "v1" "Secret" .Release.Namespace $name).data "private_key" }}
24+
{{- $previous := lookup "v1" "Secret" .Release.Namespace $name }}
25+
{{- if and $previous (not .Values.st2.ssh_key) }}
26+
private_key: {{ $previous.data.private_key }}
2627
{{ else }}
2728
private_key: {{ default (genPrivateKey "rsa") .Values.st2.ssh_key | b64enc | quote }}
2829
{{ end }}

templates/secrets_st2auth.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ data:
2424
# Username, used to login to StackStorm system (default: st2admin)
2525
username: {{ required "A valid secret 'st2.username' is required for StackStorm auth!" .Values.st2.username | b64enc | quote }}
2626
# Password, used to login to StackStorm system (default: auto-generated)
27-
{{- if and .Release.IsUpgrade (not .Values.st2.resetPassword) }}
28-
password: {{ index (lookup "v1" "Secret" .Release.Namespace $name).data "password" }}
27+
{{- $previous := lookup "v1" "Secret" .Release.Namespace $name }}
28+
{{- if and $previous (not .Values.st2.password) }}
29+
password: {{ $previous.data.password }}
2930
{{ else }}
3031
password: {{ default (randAlphaNum 12) .Values.st2.password | b64enc | quote }}
3132
{{ end }}

values.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,17 @@ serviceAccount:
4343
st2:
4444
# Username, used to login to StackStorm system
4545
username: st2admin
46-
# Password, used to login to StackStorm system (auto-generated by default)
47-
# The password (set here or auto-generated) is preserved across upgrades.
46+
# Password, used to login to StackStorm system
47+
# If set, st2.password always overrides any existing password.
48+
# If not set, the password is auto-generated on install and preserved across upgrades.
4849
#password: Ch@ngeMe
49-
# To force the password to reset (using st2.password, or a newly generated one),
50-
# you can use `helm upgrade --set st2.resetPassword=true`.
51-
resetPassword: false
5250
# ST2 crypto key for the K/V datastore.
5351
# See https://docs.stackstorm.com/datastore.html#securing-secrets-admin-only for more info.
5452
# Warning! Replace with your own generated key!
5553
#datastore_crypto_key: {"hmacKey": {"hmacKeyString": "", "size": 256}, "size": 256, "aesKeyString": "", "mode": "CBC"}
5654
# SSH private key for the 'stanley' system user ('system_user.ssh_key_file' in st2.conf)
57-
# (auto-generated by default, preserved across upgrades)
55+
# If set, st2.ssh_key always overrides any existing ssh_key.
56+
# If not set, the ssh_key is auto-generated on install and preserved across upgrades.
5857
#ssh_key: |-
5958
# -----BEGIN RSA PRIVATE KEY-----
6059
# ...

0 commit comments

Comments
 (0)