1+ # #######################################################################
2+ # DEPLOYMENT — MCP Context-Forge (Gateway)
3+ #
4+ # • Spins up the HTTP / WebSocket gateway pods.
5+ # • Injects release-scoped hosts for Postgres & Redis.
6+ # • Pulls ALL other environment variables from the dedicated
7+ # ConfigMap + Secret via envFrom (mounted later in this file).
8+ # • DATABASE_URL and REDIS_URL are declared LAST so that every
9+ # $(POSTGRES_*) / $(REDIS_*) placeholder is already defined.
10+ # #######################################################################
111apiVersion : apps/v1
212kind : Deployment
313metadata :
14+ # <release>-mcp-stack-app
415 name : {{ include "mcp-stack.fullname" . }}-app
516 labels :
617 {{- include "mcp-stack.labels" . | nindent 4 }}
718spec :
819 replicas : {{ .Values.mcpContextForge.replicaCount }}
20+
921 selector :
1022 matchLabels :
1123 app : {{ include "mcp-stack.fullname" . }}-app
24+
1225 template :
1326 metadata :
1427 labels :
1528 app : {{ include "mcp-stack.fullname" . }}-app
29+
1630 spec :
1731 containers :
1832 - name : mcp-context-forge
1933 image : " {{ .Values.mcpContextForge.image.repository }}:{{ .Values.mcpContextForge.image.tag }}"
2034 imagePullPolicy : {{ .Values.mcpContextForge.image.pullPolicy }}
35+
36+ # Gateway's internal port
2137 ports :
2238 - containerPort : {{ .Values.mcpContextForge.containerPort }}
39+
40+ # ###############################################################
41+ # EXPLICIT ENV-VARS
42+ # • DB/cache endpoints must be set here so they can be used as
43+ # placeholders in the derived URL variables declared below.
44+ # ###############################################################
2345 env :
24- # ── core settings ────────────────────────────────────────────
25- - name : HOST
26- value : " {{ .Values.mcpContextForge.env.host }}"
46+ # ---------- POSTGRES ----------
2747 - name : POSTGRES_HOST
28- value : " {{ .Values.mcpContextForge.env. postgres.host }} "
48+ value : {{ printf "%s- postgres" (include "mcp-stack.fullname" .) }}
2949 - name : POSTGRES_PORT
3050 value : " {{ .Values.mcpContextForge.env.postgres.port }}"
3151 - name : POSTGRES_DB
@@ -40,17 +60,31 @@ spec:
4060 secretKeyRef :
4161 name : {{ include "mcp-stack.postgresSecretName" . | trim }}
4262 key : POSTGRES_PASSWORD
63+
64+ # ---------- REDIS ----------
4365 - name : REDIS_HOST
44- value : " {{ .Values.mcpContextForge.env. redis.host }} "
66+ value : {{ printf "%s- redis" (include "mcp-stack.fullname" .) }}
4567 - name : REDIS_PORT
4668 value : " {{ .Values.mcpContextForge.env.redis.port }}"
4769
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 }}
70+ # ---------- DERIVED URLS ----------
71+ # These MUST be placed *after* the concrete vars above so the
72+ # $(…) placeholders are expanded correctly inside the pod.
73+ - name : DATABASE_URL
74+ value : >-
75+ postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)
76+ - name : REDIS_URL
77+ value : " redis://$(REDIS_HOST):$(REDIS_PORT)/0"
78+
79+ # ###############################################################
80+ # BULK ENV-VARS — pulled from ConfigMap + Secret
81+ # ###############################################################
82+ envFrom :
83+ - secretRef :
84+ name : {{ include "mcp-stack.fullname" . }}-gateway-secret
85+ - configMapRef :
86+ name : {{ include "mcp-stack.fullname" . }}-gateway-config
87+
88+ # Resource requests / limits
5589 resources :
5690{{- toYaml .Values.mcpContextForge.resources | nindent 12 }}
0 commit comments