|
3 | 3 | • Rendered after every install/upgrade.
|
4 | 4 | • Surfaces endpoints, credentials and helper commands so you can
|
5 | 5 | start interacting with the stack right away.
|
| 6 | + • Set showSecrets to show secrets. |
6 | 7 | */ -}}
|
7 | 8 |
|
8 | 9 | {{- $ns := .Release.Namespace }}
|
9 | 10 | {{- $fullName := include "mcp-stack.fullname" . }}
|
10 | 11 |
|
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) ─ */}} |
14 | 16 | {{- $gatewaySvc := printf "%s-mcpgateway" $fullName }}
|
15 | 17 | {{- $ftSvc := printf "%s-mcp-fast-time-server" $fullName }}
|
16 | 18 | {{- $postgresSvc := printf "%s-postgres" $fullName }}
|
|
20 | 22 | {{- $gwSecret := printf "%s-gateway-secret" $fullName }}
|
21 | 23 | {{- $pgSecret := include "mcp-stack.postgresSecretName" . }}
|
22 | 24 |
|
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) */}} |
29 | 26 | {{- $basicAuthPass := "" }}
|
30 | 27 | {{- $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 }} |
41 | 37 | {{- end }}
|
42 | 38 |
|
43 |
| -{{- /* ----------------------------------------------------------------- |
44 |
| - Convenience shorthands |
45 |
| -------------------------------------------------------------------*/ -}} |
| 39 | +{{- /* ─── Convenience ports ─────────────────────────────── */}} |
46 | 40 | {{- $gwPort := .Values.mcpContextForge.service.port | default 80 }}
|
47 | 41 | {{- $pgPort := .Values.postgres.service.port | default 5432 }}
|
48 | 42 | {{- $redisPort := .Values.redis.service.port | default 6379 }}
|
|
59 | 53 | {{- end }}
|
60 | 54 | • Basic-Auth :
|
61 | 55 | 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 }} |
64 | 63 | • 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`) |
66 | 68 | • Port-forward : `kubectl -n {{ $ns }} port-forward svc/{{ $gatewaySvc }} 4444:{{ $gwPort }}`
|
67 | 69 |
|
68 | 70 | {{- /* ════════════ Fast-Time-Server ════════════ */}}
|
|
75 | 77 | • Host / Port : {{ $postgresSvc }}.{{ $ns }}.svc.cluster.local:{{ $pgPort }}
|
76 | 78 | • DB : {{ .Values.postgres.credentials.database }}
|
77 | 79 | • 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`) |
80 | 86 |
|
81 | 87 | 🔑 **Redis**
|
82 | 88 | • Host / Port : {{ $redisSvc }}.{{ $ns }}.svc.cluster.local:{{ $redisPort }}
|
|
92 | 98 | # 1) Forward the Gateway locally (skip if using ingress):
|
93 | 99 | kubectl -n {{ $ns }} port-forward svc/{{ $gatewaySvc }} 4444:{{ $gwPort }} &
|
94 | 100 |
|
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 }} |
96 | 103 | export GW_TOKEN=$(curl -s -u '{{ .Values.mcpContextForge.secret.BASIC_AUTH_USER }}:{{ $basicAuthPass }}' \
|
97 | 104 | -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 }} |
98 | 108 |
|
99 | 109 | # 3) Register the Fast-Time-Server with the Gateway:
|
100 | 110 | curl -s -X POST \
|
|
0 commit comments