Extend K8S and RIC installation instructions
[it/dep.git] / ric-infra / 30-Kong / helm / kong / charts / kong / templates / controller-deployment.yaml
1 {{- if (and (.Values.ingressController.enabled) (not (eq .Values.env.database "off"))) }}
2 apiVersion: apps/v1
3 kind: Deployment
4 metadata:
5   name: "{{ template "kong.fullname" . }}-controller"
6   labels:
7     app: "{{ template "kong.name" . }}"
8     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
9     release: "{{ .Release.Name }}"
10     heritage: "{{ .Release.Service }}"
11     component: "controller"
12 spec:
13   replicas: {{ .Values.ingressController.replicaCount }}
14   selector:
15     matchLabels:
16       app: {{ template "kong.name" . }}
17       release: {{ .Release.Name }}
18       component: "controller"
19   template:
20     metadata:
21     {{- if .Values.podAnnotations }}
22       annotations:
23 {{ toYaml .Values.podAnnotations | indent 8 }}
24     {{- end }}
25       labels:
26         app: {{ template "kong.name" . }}
27         release: {{ .Release.Name }}
28         component: "controller"
29     spec:
30       serviceAccountName: {{ template "kong.serviceAccountName" . }}
31       {{- if .Values.image.pullSecrets }}
32       imagePullSecrets:
33       {{- range .Values.image.pullSecrets }}
34         - name: {{ . }}
35       {{- end }}
36       {{- end }}
37       initContainers:
38       {{- include "kong.wait-for-db" . | nindent 6 }}
39       containers:
40       - name: admin-api
41         image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
42         imagePullPolicy: {{ .Values.image.pullPolicy }}
43         env:
44         - name: KONG_PROXY_LISTEN
45           value: 'off'
46         {{- if .Values.enterprise.enabled }}
47         {{- if .Values.enterprise.rbac.enabled }}
48         # TODO: uncomment this once we have a means of securely providing the
49         # controller its token using a secret.
50         #- name: KONG_ENFORCE_RBAC
51         #  value: "on"
52         {{- end }}
53         # the controller admin API should not receive requests to create admins or developers
54         # never enable SMTP on it as such
55         {{- if .Values.enterprise.smtp.enabled }}
56         - name: KONG_SMTP_MOCK
57           value: "on"
58         {{- else }}
59         - name: KONG_SMTP_MOCK
60           value: "on"
61         {{- end }}
62         {{- include "kong.license" . | nindent 8 }}
63         {{- end }}
64         {{- if .Values.admin.useTLS }}
65         - name: KONG_ADMIN_LISTEN
66           value: "0.0.0.0:{{ .Values.admin.containerPort }} ssl"
67         {{- else }}
68         - name: KONG_ADMIN_LISTEN
69           value: 0.0.0.0:{{ .Values.admin.containerPort }}
70         {{- end }}
71         {{- if .Values.postgresql.enabled }}
72         - name: KONG_PG_HOST
73           value: {{ template "kong.postgresql.fullname" . }}
74         - name: KONG_PG_PASSWORD
75           valueFrom:
76             secretKeyRef:
77               name: {{ template "kong.postgresql.fullname" . }}
78               key: postgresql-password
79         {{- end }}
80         {{- if .Values.cassandra.enabled }}
81         - name: KONG_CASSANDRA_CONTACT_POINTS
82           value: {{ template "kong.cassandra.fullname" . }}
83         {{- end }}
84         {{- include "kong.env" .  | indent 8 }}
85         ports:
86         - name: admin
87           containerPort: {{ .Values.admin.containerPort }}
88           protocol: TCP
89         readinessProbe:
90 {{ toYaml .Values.readinessProbe | indent 10 }}
91         livenessProbe:
92 {{ toYaml .Values.livenessProbe | indent 10 }}
93         resources:
94 {{ toYaml .Values.resources | indent 10 }}
95       {{- include "kong.controller-container" . | nindent 6 }}
96 {{- end -}}