-
Notifications
You must be signed in to change notification settings - Fork 433
/
1-gloo-deployment.yaml
274 lines (273 loc) · 10.3 KB
/
1-gloo-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
{{ define "gloo.deploymentSpec" }}
{{- $image := .Values.gloo.deployment.image }}
{{- $statsConfig := coalesce .Values.gloo.deployment.stats .Values.global.glooStats -}}
{{- if .Values.global }}
{{- $image = merge .Values.gloo.deployment.image .Values.global.image }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{ include "gloo.labels" . | indent 4}}
gloo: gloo
name: gloo
namespace: {{ .Release.Namespace }}
spec:
replicas: {{ .Values.gloo.deployment.replicas }}
selector:
matchLabels:
gloo: gloo
template:
metadata:
labels:
gloo: gloo
{{- if .Values.gloo.deployment.extraGlooLabels }}
{{- range $key, $value := .Values.gloo.deployment.extraGlooLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if .Values.global.istioIntegration.disableAutoinjection }}
sidecar.istio.io/inject: "false"
{{- end }}
annotations:
{{- if $statsConfig.enabled }}
prometheus.io/path: /metrics
prometheus.io/port: "9091"
prometheus.io/scrape: "true"
gloo.solo.io/oss-image-tag: {{ .Values.gloo.deployment.ossImageTag }}
{{- end}}
{{- if .Values.gloo.deployment.extraGlooAnnotations }}
{{- range $key, $value := .Values.gloo.deployment.extraGlooAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{ with .Values.gloo.deployment.podSecurityContext }}
{{- include "gloo.securityContext" (dict "values" . "defaults" (dict)) | indent 6 -}}
{{- end }}
{{- include "gloo.pullSecret" $image | nindent 6 -}}
serviceAccountName: gloo
{{- include "gloo.podSpecStandardFields" .Values.gloo.deployment | nindent 6 -}}
volumes:
{{- if .Values.global.glooMtls.enabled }}
- name: gloo-mtls-certs
secret:
defaultMode: 420
secretName: gloo-mtls-certs
- name: envoy-sidecar-config
configMap:
name: envoy-sidecar-config
{{- end }}
- name: labels-volume
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
{{- if and .Values.gateway.enabled .Values.gateway.validation.enabled }}
- name: validation-certs
secret:
defaultMode: 420
secretName: {{ .Values.gateway.validation.secretName }}
{{- end }}
containers:
{{- if .Values.global.glooMtls.enabled }}
{{- $sdsImage := merge .Values.global.glooMtls.sds.image .Values.global.image }}
{{- $envoyImage := merge .Values.global.glooMtls.envoy.image .Values.global.image}}
- env:
- name: ENVOY_SIDECAR
value: "true"
name: envoy-sidecar
image: {{ template "gloo.image" $envoyImage }}
imagePullPolicy: {{ $envoyImage.pullPolicy }}
{{- $securityDefaults := dict "runAsNonRoot" true }}
{{- if not .Values.gloo.deployment.floatingUserId }}
{{- $_ := set $securityDefaults "runAsUser" .Values.gloo.deployment.runAsUser }}
{{- end }}
{{- include "gloo.containerSecurityContext" (dict "values" .Values.global.glooMtls.envoy.securityContext "defaults" $securityDefaults "podSecurityStandards" .Values.global.podSecurityStandards "indent" 8) }}
ports:
- containerPort: {{ .Values.gloo.deployment.xdsPort }}
name: grpc-xds
protocol: TCP
- containerPort: {{ .Values.gloo.deployment.restXdsPort }}
name: rest-xds
protocol: TCP
readinessProbe:
tcpSocket:
port: {{ .Values.gloo.deployment.xdsPort }}
initialDelaySeconds: 3
periodSeconds: 10
failureThreshold: 3
{{- if .Values.gloo.deployment.livenessProbeEnabled }}
livenessProbe:
httpGet:
path: /healthz
port: 8765
initialDelaySeconds: 3
periodSeconds: 10
failureThreshold: 3
{{- end}}
volumeMounts:
- mountPath: /etc/envoy
name: envoy-sidecar-config
- mountPath: /etc/envoy/ssl
name: gloo-mtls-certs
readOnly: true
{{- if .Values.global.glooMtls.envoySidecarResources }}
resources:
{{ toYaml .Values.global.glooMtls.envoySidecarResources | indent 10}}
{{- end}}
- name: sds
image: {{ template "gloo.image" $sdsImage }}
imagePullPolicy: {{ $sdsImage.pullPolicy }}
env:
- name: GLOO_MTLS_SDS_ENABLED
value: "true"
{{- $securityDefaults := dict "runAsNonRoot" true }}
{{- if not .Values.gloo.deployment.floatingUserId -}}
{{- $_ := set $securityDefaults "runAsUser" .Values.gloo.deployment.runAsUser}}
{{- end -}}
{{- include "gloo.containerSecurityContext" (dict "values" .Values.global.glooMtls.sds.securityContext "defaults" $securityDefaults "podSecurityStandards" .Values.global.podSecurityStandards "indent" 8) }}
ports:
- containerPort: {{ .Values.gloo.deployment.validationPort }}
name: validation
protocol: TCP
readinessProbe:
tcpSocket:
port: {{ .Values.gloo.deployment.validationPort }}
initialDelaySeconds: 3
periodSeconds: 10
failureThreshold: 3
volumeMounts:
- mountPath: /etc/envoy/ssl
name: gloo-mtls-certs
readOnly: true
{{- if .Values.global.glooMtls.sdsResources }}
resources:
{{ toYaml .Values.global.glooMtls.sdsResources | indent 10}}
{{- end}}
{{- end }}
- image: {{template "gloo.image" $image }}
imagePullPolicy: {{ $image.pullPolicy }}
name: gloo
{{- if .Values.gloo.deployment.resources }}
resources:
{{ toYaml .Values.gloo.deployment.resources | indent 10}}
{{- else}}
resources:
requests:
cpu: 500m
memory: 256Mi
{{- end -}}
{{- $capabilities := dict "drop" (list "ALL") -}}
{{- $securityDefaults := dict "runAsNonRoot" true "capabilities" $capabilities "readOnlyRootFilesystem" true "allowPrivilegeEscalation" false -}}
{{- /* set floatingUserId to true in the helm install to let the pod be assigned a dynamic user ID */ -}}
{{- /* see https://github.com/helm/helm/issues/1707#issuecomment-520357573 */ -}}
{{- /* the user id may be set quite high -- openshift wants userids that may get printed as scientific notation */ -}}
{{- /* If you specify your own securityContext, floatingUserId will have no effect */ -}}
{{- if not .Values.gloo.deployment.floatingUserId -}}
{{- $_ := set $securityDefaults "runAsUser" .Values.gloo.deployment.runAsUser }}
{{- end -}}
{{- include "gloo.containerSecurityContext" (dict "values" .Values.gloo.deployment.glooContainerSecurityContext "defaults" $securityDefaults "podSecurityStandards" .Values.global.podSecurityStandards "indent" 8) }}
ports:
{{- if not .Values.global.glooMtls.enabled }}
- containerPort: {{ .Values.gloo.deployment.xdsPort }}
name: grpc-xds
protocol: TCP
- containerPort: {{ .Values.gloo.deployment.restXdsPort }}
name: rest-xds
protocol: TCP
{{- end }}
- containerPort: {{ .Values.gloo.deployment.validationPort }}
name: grpc-validation
protocol: TCP
- containerPort: {{ .Values.gloo.deployment.proxyDebugPort }}
name: grpc-proxydebug
protocol: TCP
- containerPort: 9979
name: wasm-cache
protocol: TCP
{{- if and $statsConfig.enabled $statsConfig.podMonitorEnabled }}
- name: http-monitoring
containerPort: 9091
{{- end }}
{{- if .Values.settings.devMode }}
- containerPort: 10010
name: dev-admin
protocol: TCP
{{- end }}
volumeMounts:
{{- if and .Values.gateway.validation.enabled .Values.gateway.enabled }}
- mountPath: /etc/gateway/validation-certs
name: validation-certs
{{- end }}
- name: labels-volume
mountPath: /etc/gloo
readOnly: true
env:
{{- if .Values.license_secret_name }}
- name: GLOO_LICENSE_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.license_secret_name }}
key: license-key
{{- end }}
{{- if .Values.gloo.deployment.customEnv }}
{{ toYaml .Values.gloo.deployment.customEnv | indent 10 }}
{{- end }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.kubeGateway.enabled }}
- name: GG_EXPERIMENTAL_K8S_GW_CONTROLLER
value: "true"
{{- end }}{{/* if .Values.kubeGateway.enabled */}}
{{- if .Values.gloo.splitLogOutput }}
- name: SPLIT_LOG_OUTPUT
value: "true"
{{- end}}
{{- if $statsConfig.enabled }}
- name: START_STATS_SERVER
value: "true"
{{- end}}
{{- if .Values.gateway.validation.enabled }}
- name: VALIDATION_MUST_START
value: "true"
{{- end}}
{{- if .Values.gloo.logLevel }}
- name: LOG_LEVEL
value: {{ .Values.gloo.logLevel }}
{{- end}}
{{- if .Values.global.istioIntegration.enableIstioSidecarOnGateway }}
- name: ENABLE_ISTIO_SIDECAR_ON_GATEWAY
value: "true"
{{- end}}
{{- if .Values.gloo.disableLeaderElection }}
- name: DISABLE_LEADER_ELECTION
value: "true"
{{- end}}
{{- if .Values.gloo.headerSecretRefNsMatchesUs }}
- name: HEADER_SECRET_REF_NS_MATCHES_US
value: "true"
{{- end}}
{{- if not .Values.global.glooMtls.enabled }}
readinessProbe:
tcpSocket:
port: {{ .Values.gloo.deployment.xdsPort }}
initialDelaySeconds: 3
periodSeconds: 10
failureThreshold: 3
{{- if .Values.gloo.deployment.livenessProbeEnabled }}
livenessProbe:
httpGet:
path: /healthz
port: 8765
initialDelaySeconds: 3
periodSeconds: 10
failureThreshold: 3
{{- end }}
{{- end }}{{/* if not .Values.global.glooMtls.enabled */}}
{{- end }} {{/* define "gloo.deploymentSpec "*/}}
{{/* Render template with yaml overrides */}}
{{- include "gloo.util.merge" (list . .Values.gloo.deployment.kubeResourceOverride "gloo.deploymentSpec") -}}