Skip to content

Commit 69b270e

Browse files
authored
Merge pull request #162 from IBM/deployment-updates
Update helm charts for configurable secrets
2 parents bbd3657 + 6f01d3b commit 69b270e

File tree

9 files changed

+442
-22
lines changed

9 files changed

+442
-22
lines changed

charts/mcp-stack/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
my-values.yaml

charts/mcp-stack/templates/_helpers.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{{- /* --------------------------------------------------------------------
2+
Helper: mcp-stack.fullname
3+
-------------------------------------------------------------------- */}}
14
{{- define "mcp-stack.fullname" -}}
25
{{- if .Values.global.fullnameOverride }}
36
{{ .Values.global.fullnameOverride }}
@@ -11,8 +14,25 @@
1114
{{- end }}
1215
{{- end }}
1316

17+
{{- /* --------------------------------------------------------------------
18+
Helper: mcp-stack.labels
19+
-------------------------------------------------------------------- */}}
1420
{{- define "mcp-stack.labels" -}}
1521
app.kubernetes.io/name: {{ include "mcp-stack.fullname" . }}
1622
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
1723
app.kubernetes.io/managed-by: {{ .Release.Service }}
1824
{{- end }}
25+
26+
{{- /* --------------------------------------------------------------------
27+
Helper: mcp-stack.postgresSecretName
28+
Returns the Secret name that the Postgres deployment should mount.
29+
If users set `postgres.existingSecret`, that name is used.
30+
Otherwise the chart-managed default "postgres-secret" is returned.
31+
-------------------------------------------------------------------- */}}
32+
{{- define "mcp-stack.postgresSecretName" -}}
33+
{{- if .Values.postgres.existingSecret }}
34+
{{- .Values.postgres.existingSecret }}
35+
{{- else }}
36+
postgres-secret
37+
{{- end }}
38+
{{- end }}

charts/mcp-stack/templates/deployment-mcp.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ spec:
2121
ports:
2222
- containerPort: {{ .Values.mcpContextForge.containerPort }}
2323
env:
24+
# ── core settings ────────────────────────────────────────────
2425
- name: HOST
2526
value: "{{ .Values.mcpContextForge.env.host }}"
2627
- name: POSTGRES_HOST
@@ -32,15 +33,24 @@ spec:
3233
- name: POSTGRES_USER
3334
valueFrom:
3435
secretKeyRef:
35-
name: postgres-secret
36-
key: user
36+
name: {{ include "mcp-stack.postgresSecretName" . | trim }}
37+
key: POSTGRES_USER
3738
- name: POSTGRES_PASSWORD
3839
valueFrom:
3940
secretKeyRef:
40-
name: postgres-secret
41-
key: password
41+
name: {{ include "mcp-stack.postgresSecretName" . | trim }}
42+
key: POSTGRES_PASSWORD
4243
- name: REDIS_HOST
4344
value: "{{ .Values.mcpContextForge.env.redis.host }}"
4445
- name: REDIS_PORT
4546
value: "{{ .Values.mcpContextForge.env.redis.port }}"
46-
resources: {{- toYaml .Values.mcpContextForge.resources | nindent 12 }}
47+
48+
# ── extras injected via values.yaml (DATABASE_URL, etc.) ─────
49+
{{- if .Values.mcpContextForge.env.extras }}
50+
{{- range .Values.mcpContextForge.env.extras }}
51+
- name: {{ .name }}
52+
value: {{ .value | quote }}
53+
{{- end }}
54+
{{- end }}
55+
resources:
56+
{{- toYaml .Values.mcpContextForge.resources | nindent 12 }}

charts/mcp-stack/templates/deployment-pgadmin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
valueFrom:
3636
secretKeyRef:
3737
name: postgres-secret
38-
key: password
38+
key: POSTGRES_PASSWORD
3939
- name: PGADMIN_LISTEN_PORT
4040
value: "{{ .Values.pgadmin.service.port }}"
4141
{{- with .Values.pgadmin.resources }}

charts/mcp-stack/templates/deployment-postgres.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ spec:
1818
containers:
1919
- name: postgres
2020
image: "{{ .Values.postgres.image.repository }}:{{ .Values.postgres.image.tag }}"
21-
imagePullPolicy: {{ .Values.postgres.image.pullPolicy }}
21+
imagePullPolicy: "{{ .Values.postgres.image.pullPolicy }}"
2222
ports:
2323
- containerPort: {{ .Values.postgres.service.port }}
2424
envFrom:
2525
- configMapRef:
2626
name: postgres-config
2727
- secretRef:
28-
name: postgres-secret
28+
name: {{ include "mcp-stack.postgresSecretName" . | trim | quote }}
2929
volumeMounts:
30-
- mountPath: /var/lib/postgresql/data
31-
name: postgredb
30+
- name: postgredb
31+
mountPath: /var/lib/postgresql/data
3232
volumes:
3333
- name: postgredb
3434
persistentVolumeClaim:
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
# templates/secret-postgres.yaml
2+
{{- if and .Values.postgres.enabled (not .Values.postgres.existingSecret) }}
13
apiVersion: v1
24
kind: Secret
35
metadata:
4-
name: postgres-secret
6+
name: "{{ include "mcp-stack.postgresSecretName" . | trim }}"
57
type: Opaque
68
stringData:
7-
user: {{ .Values.postgres.credentials.user | quote }}
8-
password: {{ .Values.postgres.credentials.password | quote }}
9+
# add the keys the Postgres image needs
10+
POSTGRES_USER: {{ .Values.postgres.credentials.user | quote }}
11+
POSTGRES_PASSWORD: {{ .Values.postgres.credentials.password | quote }}
12+
POSTGRES_DB: {{ .Values.postgres.credentials.database | quote }}
13+
{{- end }}

charts/mcp-stack/values.yaml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,38 @@ global:
33
nameOverride: ""
44
fullnameOverride: ""
55

6+
# ───────────────────────────────────────────────────────────────────────────
67
mcpContextForge:
78
replicaCount: 1
9+
810
image:
911
repository: ghcr.io/ibm/mcp-context-forge
10-
tag: latest
12+
tag: latest # pin a version tag in prod
1113
pullPolicy: IfNotPresent
14+
1215
service:
1316
type: ClusterIP
1417
port: 80
18+
1519
containerPort: 4444
20+
1621
resources:
1722
limits:
1823
cpu: 200m
1924
memory: 1024Mi
2025
requests:
2126
cpu: 100m
2227
memory: 512Mi
28+
2329
ingress:
2430
enabled: true
2531
className: nginx
26-
host: gateway.local
32+
host: gateway.local # change to your domain
2733
path: /
2834
pathType: Prefix
2935
annotations:
3036
nginx.ingress.kubernetes.io/rewrite-target: /
37+
3138
env:
3239
host: 0.0.0.0
3340
postgres:
@@ -39,26 +46,51 @@ mcpContextForge:
3946
redis:
4047
host: redis
4148
port: 6379
49+
extras:
50+
- name: CACHE_TYPE
51+
value: redis
52+
- name: REDIS_URL
53+
value: "redis://$(REDIS_HOST):$(REDIS_PORT)/0"
54+
- name: DATABASE_URL
55+
value: "postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)"
56+
57+
# Mount shared Secret & ConfigMap
58+
envFrom:
59+
- secretRef:
60+
name: mcp-gateway-secret
61+
- configMapRef:
62+
name: mcp-gateway-config
4263

64+
# ───────────────────────────────────────────────────────────────────────────
4365
postgres:
4466
enabled: true
67+
4568
image:
4669
repository: postgres
4770
tag: "17"
4871
pullPolicy: IfNotPresent
72+
4973
service:
5074
type: ClusterIP
5175
port: 5432
76+
5277
persistence:
5378
enabled: true
54-
storageClassName: manual
79+
storageClassName: manual # pick your StorageClass
5580
accessModes: [ReadWriteMany]
5681
size: 5Gi
82+
83+
# Leave this empty to have Helm autogenerate postgres-secret
84+
# (based on the credentials block below). If you already have
85+
# a Secret with the correct keys, put its name here instead.
86+
existingSecret: ""
87+
5788
credentials:
5889
database: postgresdb
5990
user: admin
60-
password: test123
91+
password: test123 # replace in production
6192

93+
# ───────────────────────────────────────────────────────────────────────────
6294
redis:
6395
enabled: true
6496
image:
@@ -69,8 +101,9 @@ redis:
69101
type: ClusterIP
70102
port: 6379
71103

104+
# ───────────────────────────────────────────────────────────────────────────
72105
pgadmin:
73-
enabled: false
106+
enabled: true
74107
image:
75108
repository: dpage/pgadmin4
76109
tag: latest
@@ -79,11 +112,12 @@ pgadmin:
79112
type: ClusterIP
80113
port: 80
81114
env:
82-
email: admin@local.test
83-
password: admin123
115+
email: admin@example.com
116+
password: admin123 # replace in production
84117

118+
# ───────────────────────────────────────────────────────────────────────────
85119
redisCommander:
86-
enabled: false
120+
enabled: true
87121
image:
88122
repository: rediscommander/redis-commander
89123
tag: latest

0 commit comments

Comments
 (0)