Skip to content

Commit 70b8862

Browse files
authored
feat(sn-console): align streamnative-console with sn-platform-slim (#1267)
- Add DB_BASE=sqlite when image tag ends with -all - Add extraEnv for custom environment variables - Add dbPasswordSecret: mount secret as files, read DB_PASSWORD/NEW_PASSWORD in startup script Made-with: Cursor <!-- ### 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 b4ca3e4 commit 70b8862

2 files changed

Lines changed: 209 additions & 13 deletions

File tree

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

Lines changed: 184 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,41 @@ spec:
7676
periodSeconds: {{ .Values.probe.startup.periodSeconds }}
7777
failureThreshold: {{ .Values.probe.startup.failureThreshold }}
7878
{{- end }}
79+
workingDir: "/pulsar-manager/console"
80+
command: ["/bin/sh", "-c"]
81+
args:
82+
- |
83+
if [ -f "/pulsar-manager/secrets/google-oauth2/GOOGLE_CLIENT_ID" ]; then
84+
export GOOGLE_CLIENT_ID=$(cat /pulsar-manager/secrets/google-oauth2/GOOGLE_CLIENT_ID)
85+
fi
86+
if [ -f "/pulsar-manager/secrets/google-oauth2/GOOGLE_CLIENT_SECRET" ]; then
87+
export GOOGLE_CLIENT_SECRET=$(cat /pulsar-manager/secrets/google-oauth2/GOOGLE_CLIENT_SECRET)
88+
fi
89+
if [ -f "/pulsar-manager/secrets/azure-oauth2/AZURE_CLIENT_ID" ]; then
90+
export AZURE_CLIENT_ID=$(cat /pulsar-manager/secrets/azure-oauth2/AZURE_CLIENT_ID)
91+
fi
92+
if [ -f "/pulsar-manager/secrets/azure-oauth2/AZURE_CLIENT_SECRET" ]; then
93+
export AZURE_CLIENT_SECRET=$(cat /pulsar-manager/secrets/azure-oauth2/AZURE_CLIENT_SECRET)
94+
fi
95+
if [ -f "/pulsar-manager/secrets/azure-oauth2/AZURE_TENANT_ID" ]; then
96+
export AZURE_TENANT_ID=$(cat /pulsar-manager/secrets/azure-oauth2/AZURE_TENANT_ID)
97+
fi
98+
if [ -f "/pulsar-manager/secrets/okta-oauth2/OKTA_CLIENT_ID" ]; then
99+
export OKTA_CLIENT_ID=$(cat /pulsar-manager/secrets/okta-oauth2/OKTA_CLIENT_ID)
100+
fi
101+
if [ -f "/pulsar-manager/secrets/okta-oauth2/OKTA_CLIENT_SECRET" ]; then
102+
export OKTA_CLIENT_SECRET=$(cat /pulsar-manager/secrets/okta-oauth2/OKTA_CLIENT_SECRET)
103+
fi
104+
if [ -f "/pulsar-manager/secrets/pulsar-jwt/TOKEN" ]; then
105+
export TOKEN=$(cat /pulsar-manager/secrets/pulsar-jwt/TOKEN)
106+
fi
107+
if [ -f "/pulsar-manager/secrets/db-password/DB_PASSWORD" ]; then
108+
export DB_PASSWORD=$(cat /pulsar-manager/secrets/db-password/DB_PASSWORD)
109+
fi
110+
if [ -f "/pulsar-manager/secrets/db-password/NEW_PASSWORD" ]; then
111+
export NEW_PASSWORD=$(cat /pulsar-manager/secrets/db-password/NEW_PASSWORD)
112+
fi
113+
/pulsar-manager/entrypoint.sh
79114
env:
80115
- name: SPRING_CONFIGURATION_FILE
81116
value: /pulsar-manager/pulsar-manager/application.properties
@@ -85,6 +120,8 @@ spec:
85120
value: {{ .Values.configData.DEFAULT_NAME }}
86121
- name: INSTANCE_NAME
87122
value: {{ .Values.configData.INSTANCE_NAME }}
123+
- name: CLUSTER_NAME
124+
value: {{ .Values.configData.CLUSTER_NAME | quote }}
88125
- name: WEB_SERVICE_URL
89126
value: {{ .Values.broker.webServiceUrl }}
90127
- name: KOP_SERVICE_URL
@@ -151,6 +188,13 @@ spec:
151188
{{- end }}
152189
- name: CONNECTOR_ENABLED
153190
value: "{{ .Values.configData.CONNECTOR_ENABLED | default "true" }}"
191+
{{- if hasSuffix "-all" (toString .Values.image.tag) }}
192+
- name: DB_BASE
193+
value: sqlite
194+
{{- end }}
195+
{{- with .Values.extraEnv }}
196+
{{ toYaml . | indent 10 }}
197+
{{- end }}
154198
{{- if .Values.login.pulsarJwt.enabled }}
155199
- name: AUTHENTICATION_NAME
156200
value: "pulsar-jwt"
@@ -208,21 +252,105 @@ spec:
208252
- secretRef:
209253
name: {{ .Values.login.pulsarJwt.config.SERVICE_ACCOUNT_SUPER_TOKEN_SECRET }}
210254
{{- end }}
211-
212-
ports:
213-
- name: frontend
214-
containerPort: {{ .Values.ports.frontend }}
215-
- name: backend
216-
containerPort: {{ .Values.ports.backend }}
217255

218256
volumeMounts:
219257
- name: streamnative-console-data
220258
mountPath: /data
259+
- name: tmp-storage
260+
mountPath: /tmp
261+
- name: run-postgresql-tmpfs
262+
mountPath: /run/postgresql
263+
- name: pulsar-manager-conf
264+
mountPath: /pulsar-manager/pulsar-manager
265+
- name: psql
266+
mountPath: /pulsar-manager/psql
221267
{{- if .Values.login.pulsarJwt.enabled }}
222268
- mountPath: /pulsar-manager/keys
223269
name: token-keys
224270
readOnly: true
225271
{{- end }}
272+
{{- if .Values.login.sso.google.enabled }}
273+
- name: google-oauth2-secret
274+
mountPath: /pulsar-manager/secrets/google-oauth2
275+
readOnly: true
276+
{{- end }}
277+
{{- if .Values.login.sso.azure.enabled }}
278+
- name: azure-oauth2-secret
279+
mountPath: /pulsar-manager/secrets/azure-oauth2
280+
readOnly: true
281+
{{- end }}
282+
{{- if .Values.login.sso.okta.enabled }}
283+
- name: okta-oauth2-secret
284+
mountPath: /pulsar-manager/secrets/okta-oauth2
285+
readOnly: true
286+
{{- end }}
287+
{{- if .Values.login.pulsarJwt.enabled }}
288+
- name: pulsar-jwt-secret
289+
mountPath: /pulsar-manager/secrets/pulsar-jwt
290+
readOnly: true
291+
{{- end }}
292+
{{- if .Values.dbPasswordSecret }}
293+
- name: db-password-secret
294+
mountPath: /pulsar-manager/secrets/db-password
295+
readOnly: true
296+
{{- end }}
297+
- name: "{{ template "sn_console.fullname" . }}-{{ .Values.component }}-gateway"
298+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
299+
imagePullPolicy: {{ .Values.image.pullPolicy }}
300+
{{- if .Values.resources }}
301+
resources:
302+
{{ toYaml .Values.resources | indent 12 }}
303+
{{- end }}
304+
{{- if .Values.probe.readiness.enabled }}
305+
readinessProbe:
306+
httpGet:
307+
path: /cloud-manager/login/enabled
308+
port: {{ .Values.ports.frontend }}
309+
initialDelaySeconds: {{ .Values.probe.readiness.initialDelaySeconds }}
310+
periodSeconds: {{ .Values.probe.readiness.periodSeconds }}
311+
failureThreshold: {{ .Values.probe.readiness.failureThreshold }}
312+
{{- end }}
313+
{{- if .Values.probe.liveness.enabled }}
314+
livenessProbe:
315+
httpGet:
316+
path: /cloud-manager/login/enabled
317+
port: {{ .Values.ports.frontend }}
318+
initialDelaySeconds: {{ .Values.probe.liveness.initialDelaySeconds }}
319+
periodSeconds: {{ .Values.probe.liveness.periodSeconds }}
320+
failureThreshold: {{ .Values.probe.liveness.failureThreshold }}
321+
{{- end }}
322+
{{- if .Values.probe.startup.enabled }}
323+
startupProbe:
324+
httpGet:
325+
path: /cloud-manager/login/enabled
326+
port: {{ .Values.ports.frontend }}
327+
initialDelaySeconds: {{ .Values.probe.startup.initialDelaySeconds }}
328+
periodSeconds: {{ .Values.probe.startup.periodSeconds }}
329+
failureThreshold: {{ .Values.probe.startup.failureThreshold }}
330+
{{- end }}
331+
workingDir: "/pulsar-manager/gateway"
332+
command: ["/pulsar-manager/gateway/gateway-entrypoint.sh"]
333+
env:
334+
- name: OPENAPI_ENABLED
335+
value: "{{ .Values.configData.OPENAPI_ENABLED | default "false" }}"
336+
ports:
337+
- name: frontend
338+
containerPort: {{ .Values.ports.frontend }}
339+
- name: backend
340+
containerPort: {{ .Values.ports.backend }}
341+
volumeMounts:
342+
- name: nginx-conf
343+
mountPath: /etc/nginx/conf.d
344+
- name: nginx-logs
345+
mountPath: /var/log/nginx
346+
- name: nginx-tmp
347+
mountPath: /var/lib/nginx/tmp
348+
- name: nginx-run
349+
mountPath: /run
350+
- name: nginx-lib-log
351+
mountPath: /var/lib/nginx/logs
352+
- name: tmp-storage
353+
mountPath: /tmp
226354

227355
volumes:
228356
{{- if not .Values.volumes.persistence }}
@@ -254,6 +382,56 @@ spec:
254382
secretName: {{ .Values.login.pulsarJwt.config.JWT_BROKER_SECRET_KEY }}
255383
{{- end }}
256384
{{- end }}
385+
{{- if .Values.login.sso.google.enabled }}
386+
- name: google-oauth2-secret
387+
secret:
388+
secretName: {{ .Values.login.sso.google.clientSecretRef }}
389+
defaultMode: 0440
390+
{{- end }}
391+
{{- if .Values.login.sso.azure.enabled }}
392+
- name: azure-oauth2-secret
393+
secret:
394+
secretName: {{ .Values.login.sso.azure.clientSecretRef }}
395+
defaultMode: 0440
396+
{{- end }}
397+
{{- if .Values.login.sso.okta.enabled }}
398+
- name: okta-oauth2-secret
399+
secret:
400+
secretName: {{ .Values.login.sso.okta.clientSecretRef }}
401+
defaultMode: 0440
402+
{{- end }}
403+
{{- if .Values.login.pulsarJwt.enabled }}
404+
- name: pulsar-jwt-secret
405+
secret:
406+
secretName: {{ .Values.login.pulsarJwt.config.SERVICE_ACCOUNT_SUPER_TOKEN_SECRET }}
407+
defaultMode: 0440
408+
{{- end }}
409+
{{- if .Values.dbPasswordSecret }}
410+
- name: db-password-secret
411+
secret:
412+
secretName: {{ .Values.dbPasswordSecret }}
413+
defaultMode: 0440
414+
{{- end }}
415+
- name: tmp-storage
416+
emptyDir: {}
417+
- name: run-postgresql-tmpfs
418+
emptyDir:
419+
medium: Memory
420+
- name: nginx-conf
421+
emptyDir: {}
422+
- name: nginx-logs
423+
emptyDir: {}
424+
- name: nginx-tmp
425+
emptyDir: {}
426+
- name: nginx-run
427+
emptyDir:
428+
medium: Memory
429+
- name: pulsar-manager-conf
430+
emptyDir: {}
431+
- name: nginx-lib-log
432+
emptyDir: {}
433+
- name: psql
434+
emptyDir: {}
257435

258436
{{- if or .Values.volumes.data.storageClass .Values.volumes.data.storageClassName }}
259437
volumeClaimTemplates:

charts/sn-console/values.yaml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# Copyright (c) 2019 - 2024 StreamNative, Inc.. All Rights Reserved.
33
#
44

5-
initialize: true
5+
initialize: false
66

77
image:
8-
repository: streamnative/sn-platform-console
9-
tag: "v1.14.2"
8+
repository: streamnative/private-cloud-console
9+
tag: "v2.3.27-all"
1010
pullPolicy: IfNotPresent
1111
hasCommand: false
1212

@@ -47,7 +47,7 @@ resources:
4747
cpu: 0.1
4848
volumes:
4949
# use a persistent volume or emptyDir
50-
persistence: true
50+
persistence: false
5151
data:
5252
name: data
5353
size: 10Gi
@@ -94,6 +94,8 @@ configData:
9494
DEFAULT_ORGANIZATION: "streamnative"
9595
# *required*: the instance name to display for the Pulsar clusters in SN console
9696
INSTANCE_NAME: "pulsar"
97+
# Optional: customize the cluster name shown in Console
98+
CLUSTER_NAME: ""
9799
GLOBAL_RESOURCE_READ_ONLY: false
98100
REDIRECT_SCHEME: ""
99101
REDIRECT_HOST: ""
@@ -108,13 +110,29 @@ configData:
108110
GRAFANA_AUTH_PROXY: false
109111
GRAFANA_AUTH_PROXY_USER: ""
110112
DEFAULT_ENVIRONMENT_NAME: "pulsar"
111-
DEFAULT_ENVIRONMENT_SERVICE_URL: ""
113+
DEFAULT_ENVIRONMENT_SERVICE_URL: "http://private-cloud-proxy:8080"
112114
BACKEND_DEFAULT_SUPER_USER_ROLE: "pulsar-manager-admin"
113115
CONNECTOR_ENABLED: true
116+
CLUSTER_NAME: "private-cloud"
117+
118+
# Extra environment variables for streamnative-console container
119+
extraEnv: []
120+
# Secret name containing DB_PASSWORD and NEW_PASSWORD keys (mounted as files; read by startup script)
121+
# The secret should have two keys: DB_PASSWORD and NEW_PASSWORD
122+
# Example command to create the secret:
123+
# kubectl create secret generic my-db-password-secret \
124+
# --from-literal=DB_PASSWORD=your-db-password \
125+
# --from-literal=NEW_PASSWORD=your-new-password
126+
# Example command to update the secret:
127+
# kubectl create secret generic my-db-password-secret \
128+
# --from-literal=DB_PASSWORD=your-new-db-password \
129+
# --from-literal=NEW_PASSWORD=your-new-password \
130+
# --dry-run=client -o yaml | kubectl apply -f -
131+
dbPasswordSecret: ""
114132

115133
login:
116134
vault:
117-
enabled: true
135+
enabled: false
118136
pulsarJwt:
119137
enabled: false
120138
config:
@@ -154,7 +172,7 @@ login:
154172

155173
# broker related settings. configure how streamnative console should access Pulsar brokers.
156174
broker:
157-
webServiceUrl: http://localhost:8080
175+
webServiceUrl: http://private-cloud-proxy:8080
158176
# kopServiceUrl: localhost:9093
159177
auth:
160178
authentication:

0 commit comments

Comments
 (0)