Moving dev back to LF Gerrit
[it/dep.git] / ric-infra / 30-Kong / helm / kong / charts / kong / templates / deployment.yaml
1 apiVersion: apps/v1
2 kind: Deployment
3 metadata:
4   name: "{{ template "kong.fullname" . }}"
5   labels:
6     app: "{{ template "kong.name" . }}"
7     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
8     release: "{{ .Release.Name }}"
9     heritage: "{{ .Release.Service }}"
10     component: app
11 spec:
12   replicas: {{ .Values.replicaCount }}
13   selector:
14     matchLabels:
15       app: {{ template "kong.name" . }}
16       release: {{ .Release.Name }}
17       component: app
18   {{- if .Values.updateStrategy }}
19   strategy:
20 {{ toYaml .Values.updateStrategy | indent 4 }}
21   {{- end }}
22
23   template:
24     metadata:
25       annotations:
26         {{- if (and (not .Values.ingressController.enabled) (eq .Values.env.database "off" )) }}
27         {{- if .Values.dblessConfig.config }}
28         checksum/dbless.config: {{ toYaml .Values.dblessConfig.config | sha256sum }}
29         {{- end }}
30         {{- end }}
31         {{- if .Values.podAnnotations }}
32 {{ toYaml .Values.podAnnotations | indent 8 }}
33         {{- end }}
34       labels:
35         app: {{ template "kong.name" . }}
36         release: {{ .Release.Name }}
37         component: app
38     spec:
39       {{- if (and (.Values.ingressController.enabled) (eq .Values.env.database "off")) }}
40       serviceAccountName: {{ template "kong.serviceAccountName" . }}
41       {{ end }}
42       {{- if .Values.image.pullSecrets }}
43       imagePullSecrets:
44       {{- range .Values.image.pullSecrets }}
45         - name: {{ . }}
46       {{- end }}
47       {{- end }}
48       {{- if not (eq .Values.env.database "off") }}
49       initContainers:
50       {{- include "kong.wait-for-db" . | nindent 6 }}
51       {{ end }}
52       containers:
53       {{- if (and (.Values.ingressController.enabled) (eq .Values.env.database "off")) }}
54       {{- include "kong.controller-container" . | nindent 6 }}
55       {{ end }}
56       - name: {{ template "kong.name" . }}
57         image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
58         imagePullPolicy: {{ .Values.image.pullPolicy }}
59         env:
60         {{- if not .Values.env.admin_listen }}
61         {{- if .Values.admin.useTLS }}
62         - name: KONG_ADMIN_LISTEN
63           value: "0.0.0.0:{{ .Values.admin.containerPort }} ssl"
64         {{- else }}
65         - name: KONG_ADMIN_LISTEN
66           value: 0.0.0.0:{{ .Values.admin.containerPort }}
67         {{- end }}
68         {{- end }}
69         {{- if not .Values.env.proxy_listen }}
70         - name: KONG_PROXY_LISTEN
71           value: {{ template "kong.kongProxyListenValue" . }}
72         {{- end }}
73         {{- if and (not .Values.env.admin_gui_listen) (.Values.enterprise.enabled) }}
74         - name: KONG_ADMIN_GUI_LISTEN
75           value: {{ template "kong.kongManagerListenValue" . }}
76         {{- end }}
77         {{- if and (not .Values.env.portal_gui_listen) (.Values.enterprise.enabled) (.Values.enterprise.portal.enabled) }}
78         - name: KONG_PORTAL_GUI_LISTEN
79           value: {{ template "kong.kongPortalListenValue" . }}
80         {{- end }}
81         {{- if and (not .Values.env.portal_api_listen) (.Values.enterprise.enabled) (.Values.enterprise.portal.enabled) }}
82         - name: KONG_PORTAL_API_LISTEN
83           value: {{ template "kong.kongPortalApiListenValue" . }}
84         {{- end }}
85         - name: KONG_NGINX_DAEMON
86           value: "off"
87         {{- if .Values.enterprise.enabled }}
88         {{- if .Values.enterprise.vitals.enabled }}
89         - name: KONG_VITALS
90           value: "on"
91         {{- end }}
92         {{- if .Values.enterprise.portal.enabled }}
93         - name: KONG_PORTAL
94           value: "on"
95         {{- if .Values.enterprise.portal.portal_auth }}
96         - name: KONG_PORTAL_AUTH
97           value: {{ .Values.enterprise.portal.portal_auth }}
98         - name: KONG_PORTAL_SESSION_CONF
99           valueFrom:
100             secretKeyRef:
101               name: {{ .Values.enterprise.portal.session_conf_secret }}
102               key: portal_session_conf
103         {{- end }}
104         {{- end }}
105         {{- if .Values.enterprise.rbac.enabled }}
106         - name: KONG_ENFORCE_RBAC
107           value: "on"
108         - name: KONG_ADMIN_GUI_AUTH
109           value: {{ .Values.enterprise.rbac.admin_gui_auth | default "basic-auth" }}
110         - name: KONG_ADMIN_GUI_AUTH_CONF
111           value: '{{ toJson .Values.enterprise.rbac.admin_gui_auth_conf }}'
112         - name: KONG_ADMIN_GUI_SESSION_CONF
113           valueFrom:
114             secretKeyRef:
115               name: {{ .Values.enterprise.rbac.session_conf_secret }}
116               key: admin_gui_session_conf
117         {{- end }}
118         {{- if .Values.enterprise.smtp.enabled }}
119         - name: KONG_PORTAL_EMAILS_FROM
120           value: {{ .Values.enterprise.smtp.portal_emails_from }}
121         - name: KONG_PORTAL_EMAILS_REPLY_TO
122           value: {{ .Values.enterprise.smtp.portal_emails_reply_to }}
123         - name: KONG_ADMIN_EMAILS_FROM
124           value: {{ .Values.enterprise.smtp.admin_emails_from }}
125         - name: KONG_ADMIN_EMAILS_REPLY_TO
126           value: {{ .Values.enterprise.smtp.admin_emails_reply_to }}
127         - name: KONG_SMTP_HOST
128           value: {{ .Values.enterprise.smtp.smtp_host }}
129         - name: KONG_SMTP_PORT
130           value: {{ .Values.enterprise.smtp.smtp_port }}
131         - name: KONG_SMTP_STARTTLS
132           value: {{ .Values.enterprise.smtp.smtp_starttls }}
133         {{- if .Values.enterprise.smtp.auth.smtp_username }}
134         - name: KONG_SMTP_USERNAME
135           value: {{ .Values.enterprise.smtp.auth.smtp_username }}
136         - name: KONG_SMTP_PASSWORD
137           valueFrom:
138             secretKeyRef:
139               name: {{ .Values.enterprise.smtp.auth.smtp_password }}
140               key: smtp_password
141         {{- end }}
142         {{- else }}
143         - name: KONG_SMTP_MOCK
144           value: "on"
145         {{- end }}
146         {{- include "kong.license" . | nindent 8 }}
147         {{- end }}
148         - name: KONG_NGINX_HTTP_INCLUDE
149           value: /kong/servers.conf
150         {{- if .Values.postgresql.enabled }}
151         - name: KONG_PG_HOST
152           value: {{ template "kong.postgresql.fullname" . }}
153         - name: KONG_PG_PORT
154           value: "{{ .Values.postgresql.service.port }}"
155         - name: KONG_PG_PASSWORD
156           valueFrom:
157             secretKeyRef:
158               name: {{ template "kong.postgresql.fullname" . }}
159               key: postgresql-password
160         {{- end }}
161         {{- if .Values.cassandra.enabled }}
162         - name: KONG_CASSANDRA_CONTACT_POINTS
163           value: {{ template "kong.cassandra.fullname" . }}
164         {{- end }}
165         {{- if (and (not .Values.ingressController.enabled) (eq .Values.env.database "off")) }}
166         - name: KONG_DECLARATIVE_CONFIG
167           value: "/kong_dbless/kong.yml"
168         {{- end }}
169         {{- include "kong.env" .  | indent 8 }}
170         ports:
171         - name: admin
172           containerPort: {{ .Values.admin.containerPort }}
173           {{- if .Values.admin.hostPort }}
174           hostPort: {{ .Values.admin.hostPort }}
175           {{- end}}
176           protocol: TCP
177         {{- if .Values.proxy.http.enabled }}
178         - name: proxy
179           containerPort: {{ .Values.proxy.http.containerPort }}
180           {{- if .Values.proxy.http.hostPort }}
181           hostPort: {{ .Values.proxy.http.hostPort }}
182           {{- end}}
183           protocol: TCP
184         {{- end }}
185         {{- if .Values.proxy.tls.enabled }}
186         - name: proxy-tls
187           containerPort: {{ .Values.proxy.tls.containerPort }}
188           {{- if .Values.proxy.tls.hostPort }}
189           hostPort: {{ .Values.proxy.tls.hostPort }}
190           {{- end}}
191           protocol: TCP
192         {{- end }}
193         - name: metrics
194           containerPort: 9542
195           protocol: TCP
196         {{- if .Values.enterprise.enabled }}
197         {{- if .Values.manager.http.enabled }}
198         - name: manager
199           containerPort: {{ .Values.manager.http.containerPort }}
200           {{- if .Values.manager.http.hostPort }}
201           hostPort: {{ .Values.manager.http.hostPort }}
202           {{- end}}
203           protocol: TCP
204         {{- end }}
205         {{- if .Values.manager.tls.enabled }}
206         - name: manager-tls
207           containerPort: {{ .Values.manager.tls.containerPort }}
208           {{- if .Values.manager.tls.hostPort }}
209           hostPort: {{ .Values.manager.tls.hostPort }}
210           {{- end}}
211           protocol: TCP
212         {{- end }}
213         {{- if .Values.portal.http.enabled }}
214         - name: portal
215           containerPort: {{ .Values.portal.http.containerPort }}
216           {{- if .Values.portal.http.hostPort }}
217           hostPort: {{ .Values.portal.http.hostPort }}
218           {{- end}}
219           protocol: TCP
220         {{- end }}
221         {{- if .Values.portal.tls.enabled }}
222         - name: portal-tls
223           containerPort: {{ .Values.portal.tls.containerPort }}
224           {{- if .Values.portal.tls.hostPort }}
225           hostPort: {{ .Values.portal.tls.hostPort }}
226           {{- end}}
227           protocol: TCP
228         {{- end }}
229         {{- if .Values.portalapi.http.enabled }}
230         - name: portalapi
231           containerPort: {{ .Values.portalapi.http.containerPort }}
232           {{- if .Values.portalapi.http.hostPort }}
233           hostPort: {{ .Values.portalapi.http.hostPort }}
234           {{- end}}
235           protocol: TCP
236         {{- end }}
237         {{- if .Values.portalapi.tls.enabled }}
238         - name: portalapi-tls
239           containerPort: {{ .Values.portalapi.tls.containerPort }}
240           {{- if .Values.portalapi.tls.hostPort }}
241           hostPort: {{ .Values.portalapi.tls.hostPort }}
242           {{- end}}
243           protocol: TCP
244         {{- end }}
245         {{- end }}
246         volumeMounts:
247           - name: custom-nginx-template-volume
248             mountPath: /kong
249           {{- if (and (not .Values.ingressController.enabled) (eq .Values.env.database "off")) }}
250           - name: kong-custom-dbless-config-volume
251             mountPath: /kong_dbless/
252           {{- end }}
253         readinessProbe:
254 {{ toYaml .Values.readinessProbe | indent 10 }}
255         livenessProbe:
256 {{ toYaml .Values.livenessProbe | indent 10 }}
257         resources:
258 {{ toYaml .Values.resources | indent 10 }}
259     {{- if .Values.affinity }}
260       affinity:
261 {{ toYaml .Values.affinity | indent 8 }}
262     {{- end }}
263     {{- if .Values.nodeSelector }}
264       nodeSelector:
265 {{ toYaml .Values.nodeSelector | indent 8 }}
266     {{- end }}
267       tolerations:
268 {{ toYaml .Values.tolerations | indent 8 }}
269       volumes:
270         - name: custom-nginx-template-volume
271           configMap:
272             name: {{ template "kong.fullname" . }}-default-custom-server-blocks
273 {{- if (and (not .Values.ingressController.enabled) (eq .Values.env.database "off")) }}
274         - name: kong-custom-dbless-config-volume
275           configMap:
276             {{- if .Values.dblessConfig.configMap }}
277             name: {{ .Values.dblessConfig.configMap }}
278             {{- else }}
279             name: {{ template "kong.dblessConfig.fullname" . }}
280             {{- end }}
281 {{- end }}