Skip to content

Commit 9ccd851

Browse files
committed
Show secrets variable, defaults to false
Signed-off-by: Mihai Criveti <[email protected]>
1 parent ebb0886 commit 9ccd851

File tree

1 file changed

+38
-28
lines changed

1 file changed

+38
-28
lines changed

charts/mcp-stack/templates/NOTES.txt

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
• Rendered after every install/upgrade.
44
• Surfaces endpoints, credentials and helper commands so you can
55
start interacting with the stack right away.
6+
• Set showSecrets to show secrets.
67
*/ -}}
78

89
{{- $ns := .Release.Namespace }}
910
{{- $fullName := include "mcp-stack.fullname" . }}
1011

11-
{{- /* -----------------------------------------------------------------
12-
Resource names (keep in sync with ./_helpers.tpl)
13-
------------------------------------------------------------------*/ -}}
12+
{{- /* ─── show / hide secrets ───────────────────────────── */}}
13+
{{- $showSecrets := false }} {{/* set to true to reveal passwords & keys */}}
14+
15+
{{- /* ─── Resource names (keep in sync with _helpers.tpl) ─ */}}
1416
{{- $gatewaySvc := printf "%s-mcpgateway" $fullName }}
1517
{{- $ftSvc := printf "%s-mcp-fast-time-server" $fullName }}
1618
{{- $postgresSvc := printf "%s-postgres" $fullName }}
@@ -20,29 +22,21 @@
2022
{{- $gwSecret := printf "%s-gateway-secret" $fullName }}
2123
{{- $pgSecret := include "mcp-stack.postgresSecretName" . }}
2224

23-
{{- /* -----------------------------------------------------------------
24-
Pull secret values so we can display them
25-
------------------------------------------------------------------*/ -}}
26-
{{- $gwSecObj := lookup "v1" "Secret" $ns $gwSecret }}
27-
{{- $pgSecObj := lookup "v1" "Secret" $ns $pgSecret }}
28-
25+
{{- /* ─── Secret look-ups (only used when $showSecrets=true) */}}
2926
{{- $basicAuthPass := "" }}
3027
{{- $jwtKey := "" }}
31-
{{- if $gwSecObj }}
32-
{{- $basicAuthPass = index $gwSecObj.data "BASIC_AUTH_PASSWORD" | b64dec }}
33-
{{- $jwtKey = index $gwSecObj.data "JWT_SECRET_KEY" | b64dec }}
34-
{{- end }}
35-
36-
{{- /* ── Postgres password ─────────────────────────────── */}}
37-
{{- $pgSec := lookup "v1" "Secret" $ns $pgSecret }}
38-
{{- $pgPass := "<secret-not-yet-created>" }}
39-
{{- if $pgSec }}
40-
{{- $pgPass = (index $pgSec.data "POSTGRES_PASSWORD" | b64dec) }}
28+
{{- $pgPass := "" }}
29+
{{- if $showSecrets }}
30+
{{- with (lookup "v1" "Secret" $ns $gwSecret) }}
31+
{{- $basicAuthPass = index .data "BASIC_AUTH_PASSWORD" | b64dec }}
32+
{{- $jwtKey = index .data "JWT_SECRET_KEY" | b64dec }}
33+
{{- end }}
34+
{{- with (lookup "v1" "Secret" $ns $pgSecret) }}
35+
{{- $pgPass = index .data "POSTGRES_PASSWORD" | b64dec }}
36+
{{- end }}
4137
{{- end }}
4238

43-
{{- /* -----------------------------------------------------------------
44-
Convenience shorthands
45-
------------------------------------------------------------------*/ -}}
39+
{{- /* ─── Convenience ports ─────────────────────────────── */}}
4640
{{- $gwPort := .Values.mcpContextForge.service.port | default 80 }}
4741
{{- $pgPort := .Values.postgres.service.port | default 5432 }}
4842
{{- $redisPort := .Values.redis.service.port | default 6379 }}
@@ -59,10 +53,18 @@
5953
{{- end }}
6054
• Basic-Auth :
6155
user = {{ .Values.mcpContextForge.secret.BASIC_AUTH_USER }}
62-
password = {{ .Values.mcpContextForge.secret.BASIC_AUTH_PASSWORD | default "<set-in-values>" }}
63-
`kubectl -n {{ $ns }} get secret {{ $gwSecret }} -o jsonpath="{.data.BASIC_AUTH_PASSWORD}" | base64 -d`
56+
{{- if $showSecrets }}
57+
password = {{ $basicAuthPass }}
58+
{{- else }}
59+
password : <hidden>
60+
{{- end }}
61+
(kubectl = `kubectl -n {{ $ns }} get secret {{ $gwSecret }} -o jsonpath="{.data.BASIC_AUTH_PASSWORD}" | base64 -d`)
62+
{{- if $showSecrets }}
6463
• JWT signing key (JWT_SECRET_KEY) = {{ $jwtKey }}
65-
`kubectl -n {{ $ns }} get secret {{ $gwSecret }} -o jsonpath="{.data.JWT_SECRET_KEY}" | base64 -d`
64+
{{- else }}
65+
• JWT signing key (JWT_SECRET_KEY) : <hidden>
66+
{{- end }}
67+
(kubectl = `kubectl -n {{ $ns }} get secret {{ $gwSecret }} -o jsonpath="{.data.JWT_SECRET_KEY}" | base64 -d`)
6668
• Port-forward : `kubectl -n {{ $ns }} port-forward svc/{{ $gatewaySvc }} 4444:{{ $gwPort }}`
6769

6870
{{- /* ════════════ Fast-Time-Server ════════════ */}}
@@ -75,8 +77,12 @@
7577
• Host / Port : {{ $postgresSvc }}.{{ $ns }}.svc.cluster.local:{{ $pgPort }}
7678
• DB : {{ .Values.postgres.credentials.database }}
7779
• User : {{ .Values.postgres.credentials.user }}
78-
• Password : {{ .Values.postgres.credentials.password | default "<set-in-values>" }}
79-
`kubectl -n {{ $ns }} get secret {{ $pgSecret }} -o jsonpath="{.data.POSTGRES_PASSWORD}" | base64 -d`
80+
{{- if $showSecrets }}
81+
• Password : {{ $pgPass | default "<secret-not-yet-created>" }}
82+
{{- else }}
83+
• Password : <hidden>
84+
{{- end }}
85+
(kubectl = `kubectl -n {{ $ns }} get secret {{ $pgSecret }} -o jsonpath="{.data.POSTGRES_PASSWORD}" | base64 -d`)
8086

8187
🔑 **Redis**
8288
• Host / Port : {{ $redisSvc }}.{{ $ns }}.svc.cluster.local:{{ $redisPort }}
@@ -92,9 +98,13 @@
9298
# 1) Forward the Gateway locally (skip if using ingress):
9399
kubectl -n {{ $ns }} port-forward svc/{{ $gatewaySvc }} 4444:{{ $gwPort }} &
94100

95-
# 2) Obtain a JWT via Basic-Auth (requires 'jq'): # TODO not yet implemented use jwt tool manually
101+
# 2) Obtain a JWT via Basic-Auth (requires 'jq'):
102+
{{- if $showSecrets }}
96103
export GW_TOKEN=$(curl -s -u '{{ .Values.mcpContextForge.secret.BASIC_AUTH_USER }}:{{ $basicAuthPass }}' \
97104
-X POST http://localhost:4444/auth/login | jq -r '.access_token')
105+
{{- else }}
106+
# export GW_TOKEN=(fetch after you retrieve the password with kubectl)
107+
{{- end }}
98108

99109
# 3) Register the Fast-Time-Server with the Gateway:
100110
curl -s -X POST \

0 commit comments

Comments
 (0)