Skip to content

Commit 6c6f651

Browse files
authored
Support save password to secret (#1258)
<!-- ### Contribution Checklist - Name the pull request in the form "[charts/<chart-name>] Title of the pull request". Skip *[charts/<chart-name>]* if the PR doesn't change a specific chart. E.g. `[docs] Fix typo in README`. - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review. - Each pull request should address only one issue, not mix up code from multiple issues. - Each commit in the pull request has a meaningful commit message - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below. **(The sections below can be removed for hotfixes of typos)** --> *(If this PR fixes a github issue, please add `Fixes #<xyz>`.)* Fixes #<xyz> *(or if this PR is one task of a github issue, please add `Master Issue: #<xyz>` to link to the master issue.)* Master Issue: #<xyz> ### Motivation *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications *Describe the modifications you've done.* ### Verifying this change - [ ] Make sure that the change passes the CI checks. *(Please pick either of the following options)* This change is a trivial rework / code cleanup without any test coverage. *(or)* This change is already covered by existing tests, such as *(please describe tests)*. *(or)* This change added tests and can be verified as follows: *(example:)* - *Added integration tests for end-to-end deployment with large payloads (10MB)* - *Extended integration test for recovery after broker failure* ### Documentation Check the box below. Need to update docs? - [ ] `doc-required` (If you need help on updating docs, create a doc issue) - [ ] `no-need-doc` (Please explain why) - [ ] `doc` (If this PR contains doc changes)
1 parent 5faf2e7 commit 6c6f651

File tree

4 files changed

+58
-20
lines changed

4 files changed

+58
-20
lines changed

charts/sn-platform-slim/templates/streamnative-console/streamnative-console-statefulset.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ spec:
134134
if [ -f "/pulsar-manager/secrets/pulsar-jwt/TOKEN" ]; then
135135
export TOKEN=$(cat /pulsar-manager/secrets/pulsar-jwt/TOKEN)
136136
fi
137+
if [ -f "/pulsar-manager/secrets/db-password/DB_PASSWORD" ]; then
138+
export DB_PASSWORD=$(cat /pulsar-manager/secrets/db-password/DB_PASSWORD)
139+
fi
140+
if [ -f "/pulsar-manager/secrets/db-password/NEW_PASSWORD" ]; then
141+
export NEW_PASSWORD=$(cat /pulsar-manager/secrets/db-password/NEW_PASSWORD)
142+
fi
137143
/pulsar-manager/entrypoint.sh
138144
env:
139145
- name: SPRING_CONFIGURATION_FILE
@@ -148,18 +154,10 @@ spec:
148154
- name: GLOBAL_RESOURCE_READ_ONLY
149155
value: "true"
150156
{{- end }}
151-
{{- if .Values.streamnative_console.configData.DB_PASSWORD }}
152-
- name: DB_PASSWORD
153-
value: {{ .Values.streamnative_console.configData.DB_PASSWORD | b64dec | quote }}
154-
{{- end }}
155157
{{- if hasSuffix "-all" .Values.images.streamnative_console.tag }}
156158
- name: DB_BASE
157159
value: sqlite
158160
{{- end }}
159-
{{- if .Values.streamnative_console.configData.NEW_PASSWORD }}
160-
- name: NEW_PASSWORD
161-
value: {{ .Values.streamnative_console.configData.NEW_PASSWORD | b64dec | quote }}
162-
{{- end }}
163161
- name: CONNECTOR_ENABLED
164162
value: "{{ .Values.streamnative_console.configData.CONNECTOR_ENABLED | default "true" }}"
165163
{{- with .Values.streamnative_console.extraEnv }}
@@ -299,6 +297,11 @@ spec:
299297
mountPath: /pulsar-manager/secrets/pulsar-jwt
300298
readOnly: true
301299
{{- end }}
300+
{{- if .Values.streamnative_console.dbPasswordSecret }}
301+
- name: db-password-secret
302+
mountPath: /pulsar-manager/secrets/db-password
303+
readOnly: true
304+
{{- end }}
302305
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.streamnative_console.component }}-gateway"
303306
image: "{{ .Values.images.streamnative_console.repository }}:{{ .Values.images.streamnative_console.tag }}"
304307
imagePullPolicy: {{ .Values.images.streamnative_console.pullPolicy }}
@@ -437,6 +440,12 @@ spec:
437440
secretName: {{ .Values.streamnative_console.login.sso.pulsarJwt.config.SERVICE_ACCOUNT_SUPER_TOKEN_SECRET }}
438441
defaultMode: 0440
439442
{{- end }}
443+
{{- if .Values.streamnative_console.dbPasswordSecret }}
444+
- name: db-password-secret
445+
secret:
446+
secretName: {{ .Values.streamnative_console.dbPasswordSecret }}
447+
defaultMode: 0440
448+
{{- end }}
440449
{{- if .Values.streamnative_console.securityContext }}
441450
securityContext: {{- toYaml .Values.streamnative_console.securityContext | nindent 8 }}
442451
{{- end }}

charts/sn-platform-slim/values.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,10 +2396,20 @@ streamnative_console:
23962396
GRAFANA_AUTH_PROXY_USER: ""
23972397
CONNECTOR_ENABLED: true
23982398
OPENAPI_ENABLED: false
2399-
# please use base64 encoded your password
2400-
DB_PASSWORD: ""
24012399
# Extra environment variables for streamnative-console container
24022400
extraEnv: []
2401+
# Secret name containing DB_PASSWORD and NEW_PASSWORD keys
2402+
# The secret should have two keys: DB_PASSWORD and NEW_PASSWORD
2403+
# Example command to create the secret:
2404+
# kubectl create secret generic my-db-password-secret \
2405+
# --from-literal=DB_PASSWORD=your-db-password \
2406+
# --from-literal=NEW_PASSWORD=your-new-password
2407+
# Example command to update the secret:
2408+
# kubectl create secret generic my-db-password-secret \
2409+
# --from-literal=DB_PASSWORD=your-new-db-password \
2410+
# --from-literal=NEW_PASSWORD=your-new-password \
2411+
# --dry-run=client -o yaml | kubectl apply -f -
2412+
dbPasswordSecret: ""
24032413

24042414
login:
24052415
sso:

charts/sn-platform/templates/streamnative-console/streamnative-console-statefulset.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ spec:
176176
if [ -f "/pulsar-manager/secrets/pulsar-jwt/TOKEN" ]; then
177177
export TOKEN=$(cat /pulsar-manager/secrets/pulsar-jwt/TOKEN)
178178
fi
179+
if [ -f "/pulsar-manager/secrets/db-password/DB_PASSWORD" ]; then
180+
export DB_PASSWORD=$(cat /pulsar-manager/secrets/db-password/DB_PASSWORD)
181+
fi
182+
if [ -f "/pulsar-manager/secrets/db-password/NEW_PASSWORD" ]; then
183+
export NEW_PASSWORD=$(cat /pulsar-manager/secrets/db-password/NEW_PASSWORD)
184+
fi
179185
/pulsar-manager/entrypoint.sh
180186
env:
181187
- name: SPRING_CONFIGURATION_FILE
@@ -192,18 +198,10 @@ spec:
192198
- name: GLOBAL_RESOURCE_READ_ONLY
193199
value: "true"
194200
{{- end }}
195-
{{- if .Values.streamnative_console.configData.DB_PASSWORD }}
196-
- name: DB_PASSWORD
197-
value: {{ .Values.streamnative_console.configData.DB_PASSWORD | b64dec | quote }}
198-
{{- end }}
199201
{{- if hasSuffix "-all" .Values.images.streamnative_console.tag }}
200202
- name: DB_BASE
201203
value: sqlite
202204
{{- end }}
203-
{{- if .Values.streamnative_console.configData.NEW_PASSWORD }}
204-
- name: NEW_PASSWORD
205-
value: {{ .Values.streamnative_console.configData.NEW_PASSWORD | b64dec | quote }}
206-
{{- end }}
207205
- name: CONNECTOR_ENABLED
208206
value: "{{ .Values.streamnative_console.configData.CONNECTOR_ENABLED | default "true" }}"
209207
{{- with .Values.streamnative_console.extraEnv }}
@@ -352,6 +350,11 @@ spec:
352350
mountPath: /pulsar-manager/secrets/pulsar-jwt
353351
readOnly: true
354352
{{- end }}
353+
{{- if .Values.streamnative_console.dbPasswordSecret }}
354+
- name: db-password-secret
355+
mountPath: /pulsar-manager/secrets/db-password
356+
readOnly: true
357+
{{- end }}
355358
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.streamnative_console.component }}-gateway"
356359
image: "{{ .Values.images.streamnative_console.repository }}:{{ .Values.images.streamnative_console.tag }}"
357360
{{- if .Values.streamnative_console.securityContext }}
@@ -496,6 +499,12 @@ spec:
496499
secretName: {{ .Values.streamnative_console.login.sso.pulsarJwt.config.SERVICE_ACCOUNT_SUPER_TOKEN_SECRET }}
497500
defaultMode: 0440
498501
{{- end }}
502+
{{- if .Values.streamnative_console.dbPasswordSecret }}
503+
- name: db-password-secret
504+
secret:
505+
secretName: {{ .Values.streamnative_console.dbPasswordSecret }}
506+
defaultMode: 0440
507+
{{- end }}
499508
{{- if .Values.streamnative_console.securityContext }}
500509
securityContext: {{- toYaml .Values.streamnative_console.securityContext | nindent 8 }}
501510
{{- end }}

charts/sn-platform/values.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,10 +2487,20 @@ streamnative_console:
24872487
CONNECTOR_ENABLED: true
24882488
CUSTOM_PAYLOAD_ENABLED: false
24892489
OPENAPI_ENABLED: false
2490-
# please use base64 encoded your password
2491-
DB_PASSWORD: ""
24922490
# Extra environment variables for streamnative-console container
24932491
extraEnv: []
2492+
# Secret name containing DB_PASSWORD and NEW_PASSWORD keys
2493+
# The secret should have two keys: DB_PASSWORD and NEW_PASSWORD
2494+
# Example command to create the secret:
2495+
# kubectl create secret generic my-db-password-secret \
2496+
# --from-literal=DB_PASSWORD=your-db-password \
2497+
# --from-literal=NEW_PASSWORD=your-new-password
2498+
# Example command to update the secret:
2499+
# kubectl create secret generic my-db-password-secret \
2500+
# --from-literal=DB_PASSWORD=your-new-db-password \
2501+
# --from-literal=NEW_PASSWORD=your-new-password \
2502+
# --dry-run=client -o yaml | kubectl apply -f -
2503+
dbPasswordSecret: ""
24942504

24952505
login:
24962506
sso:

0 commit comments

Comments
 (0)