@@ -6,15 +6,17 @@ Gateway pod template shared by the StatefulSet and Deployment workload shapes.
66*/ }}
77{{- define " openshell.gatewayPodTemplate" -}}
88{{- $gatewayConfig := .Values.gatewayConfig | default dict -}}
9- {{- $gatewayRuntimeConfig := get $gatewayConfig " openshell.gateway" | default dict -}}
109{{- $oidcRuntimeConfig := get $gatewayConfig " openshell.gateway.oidc" | default dict -}}
11- {{- $kubernetesRuntimeConfig := get $gatewayConfig " openshell.drivers.kubernetes" | default dict -}}
10+ {{- if not (get $oidcRuntimeConfig " issuer" ) -}}{{- $oidcRuntimeConfig = .Values.server.oidc | default dict -}}{{- end -}}
11+ {{- $kubernetesRuntimeConfig := include " openshell.effectiveKubernetesConfig" . | fromYaml -}}
1212{{- $spiffeSocketPath := get $kubernetesRuntimeConfig " provider_spiffe_workload_api_socket_path" -}}
1313{{- $hasExternalCredentialDriver := or (eq (include " openshell.credentialDriverEnabled" (list . " kubernetes-secrets" )) " true" ) (eq (include " openshell.credentialDriverEnabled" (list . " vault" )) " true" ) -}}
1414{{- $vaultCredentialDriverEnabled := eq (include " openshell.credentialDriverEnabled" (list . " vault" )) " true" -}}
1515{{- $credentialDrivers := .Values.credentialDrivers | default dict -}}
1616{{- $vaultResources := get $credentialDrivers " vault" | default dict -}}
17- {{- $vaultCaConfigMapName := get $vaultResources " caConfigMapName" -}}
17+ {{- $legacyCredentialDrivers := .Values.server.credentialDrivers | default dict -}}
18+ {{- $legacyVaultResources := get $legacyCredentialDrivers " vault" | default dict -}}
19+ {{- $vaultCaConfigMapName := get $vaultResources " caConfigMapName" | default (get $legacyVaultResources " caConfigMapName" ) -}}
1820metadata:
1921 annotations:
2022 # Roll the gateway workload when the rendered gateway TOML changes - the
6264 - {{ .Values.server.dbUrl | quote }}
6365 {{- end }}
6466 env:
67+ - name: OPENSHELL_REPLICA_ID
68+ valueFrom:
69+ fieldRef:
70+ fieldPath: metadata.name
71+ - name: OPENSHELL_POD_NAME
72+ valueFrom:
73+ fieldRef:
74+ fieldPath: metadata.name
75+ - name: OPENSHELL_POD_NAMESPACE
76+ valueFrom:
77+ fieldRef:
78+ fieldPath: metadata.namespace
79+ {{- if eq (include " openshell.workloadKind" . ) " deployment" }}
80+ - name: OPENSHELL_POD_IP
81+ valueFrom:
82+ fieldRef:
83+ fieldPath: status.podIP
84+ - name: OPENSHELL_PEER_ENDPOINT
85+ value: {{ printf " %s ://$(OPENSHELL_POD_IP):%d " (ternary " http" " https" (default false .Values.server.disableTls )) (int .Values.service.port ) | quote }}
86+ {{- end }}
87+ - name: OPENSHELL_SERVICE_ACCOUNT_NAME
88+ value: {{ include " openshell.serviceAccountName" . | quote }}
89+ - name: OPENSHELL_PEER_SERVICE_NAME
90+ value: {{ include " openshell.peerServiceName" . | quote }}
91+ - name: OPENSHELL_PEER_TOKEN_AUDIENCE
92+ value: " openshell-gateway-peer"
93+ - name: OPENSHELL_PEER_SERVICE_ACCOUNT_TOKEN_FILE
94+ value: /var/run/secrets/openshell-peer/token
95+ - name: OPENSHELL_PEER_POD_LABELS
96+ value: {{ printf " app.kubernetes.io/name=%s ,app.kubernetes.io/instance=%s " (include " openshell.name" . ) .Release.Name | quote }}
97+ {{- if not .Values.server.disableTls }}
98+ - name: OPENSHELL_PEER_TLS_SERVER_NAME
99+ value: {{ printf " %s .%s .svc.cluster.local" (include " openshell.fullname" . ) .Release.Namespace | quote }}
100+ {{- if or .Values.pkiInitJob.enabled .Values.certManager.enabled }}
101+ - name: OPENSHELL_PEER_TLS_CA_FILE
102+ value: /etc/openshell-tls/server/ca.crt
103+ {{- end }}
104+ {{- if eq (include " openshell.gatewayClientCaEnabled" . ) " true" }}
105+ - name: OPENSHELL_PEER_TLS_CERT_FILE
106+ value: /etc/openshell-tls/peer-client/tls.crt
107+ - name: OPENSHELL_PEER_TLS_KEY_FILE
108+ value: /etc/openshell-tls/peer-client/tls.key
109+ {{- end }}
110+ {{- end }}
65111 {{- if not $hasExternalCredentialDriver }}
66112 - name: {{ include " openshell.credentialStorageKeyEncryptionKeyEnvName" . }}
67113 valueFrom:
80126 # mounted at /etc/openshell/gateway.toml. Secret-bearing settings use
81127 # env vars that the TOML references by name. Some process-level
82128 # settings consumed by libraries outside gateway code also remain here.
83- {{- if and (get $oidcRuntimeConfig " issuer" ) .Values.oidc.caConfigMapName }}
129+ {{- if and (get $oidcRuntimeConfig " issuer" ) .Values.server. oidc.caConfigMapName }}
84130 # OIDC issuer custom-CA: rustls/reqwest read SSL_CERT_FILE for
85131 # outbound TLS verification. This is a process-level env var
86132 # consumed by the TLS stack itself, not by gateway code, so it
@@ -109,6 +155,9 @@ spec:
109155 - name: sandbox-jwt
110156 mountPath: /etc/openshell-jwt
111157 readOnly: true
158+ - name: gateway-peer-token
159+ mountPath: /var/run/secrets/openshell-peer
160+ readOnly: true
112161 {{- if not .Values.server.disableTls }}
113162 - name: tls-cert
114163 mountPath: /etc/openshell-tls/server
@@ -119,19 +168,22 @@ spec:
119168 readOnly: true
120169 {{- end }}
121170 {{- if eq (include " openshell.gatewayClientCaEnabled" . ) " true" }}
171+ - name: peer-client-tls
172+ mountPath: /etc/openshell-tls/peer-client
173+ readOnly: true
122174 - name: tls-client-ca
123175 mountPath: /etc/openshell-tls/client-ca
124176 readOnly: true
125177 {{- end }}
126178 {{- end }}
127- {{- if and (get $oidcRuntimeConfig " issuer" ) .Values.oidc.caConfigMapName }}
179+ {{- if and (get $oidcRuntimeConfig " issuer" ) .Values.server. oidc.caConfigMapName }}
128180 - name: oidc-ca
129181 mountPath: /etc/openshell-tls/oidc-ca
130182 readOnly: true
131183 {{- end }}
132184 {{- if and $vaultCredentialDriverEnabled $vaultCaConfigMapName }}
133185 - name: vault-ca
134- mountPath: /etc/openshell-tls/vault
186+ mountPath: /etc/openshell-tls/vault-ca
135187 readOnly: true
136188 {{- end }}
137189 {{- if .Values.upstreamProxy.caBundle.configMapName }}
@@ -192,6 +244,14 @@ spec:
192244 secret:
193245 secretName: {{ include " openshell.sandboxJwtSecretName" . }}
194246 defaultMode: {{ .Values.server.sandboxJwt.secretDefaultMode | default 0400 }}
247+ - name: gateway-peer-token
248+ projected:
249+ defaultMode: 0400
250+ sources:
251+ - serviceAccountToken:
252+ path: token
253+ audience: openshell-gateway-peer
254+ expirationSeconds: 3600
195255 {{- if not .Values.server.disableTls }}
196256 - name: tls-cert
197257 secret:
@@ -202,6 +262,9 @@ spec:
202262 secretName: {{ include " openshell.fullname" . }}-server-external-tls
203263 {{- end }}
204264 {{- if eq (include " openshell.gatewayClientCaEnabled" . ) " true" }}
265+ - name: peer-client-tls
266+ secret:
267+ secretName: {{ .Values.server.tls.clientTlsSecretName }}
205268 - name: tls-client-ca
206269 secret:
207270 {{- if or (and .Values.pkiInitJob.enabled (not .Values.certManager.enabled )) (and .Values.certManager.enabled .Values.certManager.clientCaFromServerTlsSecret ) }}
@@ -214,10 +277,10 @@ spec:
214277 {{- end }}
215278 {{- end }}
216279 {{- end }}
217- {{- if and (get $oidcRuntimeConfig " issuer" ) .Values.oidc.caConfigMapName }}
280+ {{- if and (get $oidcRuntimeConfig " issuer" ) .Values.server. oidc.caConfigMapName }}
218281 - name: oidc-ca
219282 configMap:
220- name: {{ .Values.oidc.caConfigMapName }}
283+ name: {{ .Values.server. oidc.caConfigMapName }}
221284 {{- end }}
222285 {{- if and $vaultCredentialDriverEnabled $vaultCaConfigMapName }}
223286 - name: vault-ca
0 commit comments