[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / contrib / components / awx / charts / awx / templates / statefulset.yaml
1 {{/*
2 # Copyright © 2019 Bell Canada
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16
17 apiVersion: apps/v1
18 kind: StatefulSet
19 metadata:
20   name: {{ include "common.fullname" . }}
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   podManagementPolicy: OrderedReady
29   replicas: {{ .Values.replicaCount }}
30   serviceName: {{ include "common.fullname" . }}
31   selector:
32     matchLabels:
33       app: {{ include "common.fullname" . }}
34       name: {{ include "common.name" . }}-web-deploy
35       service: django
36   template:
37     metadata:
38       labels:
39         app: {{ include "common.fullname" . }}
40         name: {{ include "common.name" . }}-web-deploy
41         release: {{ include "common.release" . }}
42         service: django
43     spec:
44
45       initContainers:
46       - name: {{ include "common.name" . }}-init-readiness
47         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         command:
50         - /app/ready.py
51         args:
52         - --container-name
53         - {{ include "common.name" . }}-mgnt
54         env:
55         - name: NAMESPACE
56           valueFrom:
57             fieldRef:
58               apiVersion: v1
59               fieldPath: metadata.namespace
60
61       containers:
62
63       - image: "{{ .Values.repository }}/{{ .Values.image.web }}"
64         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65         name: {{ include "common.name" . }}-web
66         ports:
67         - containerPort: {{ .Values.service.web.internalPort }}
68           protocol: TCP
69         resources:
70           requests:
71             cpu: 500m
72             memory: 1Gi
73         volumeMounts:
74         - mountPath: /etc/tower/settings.py
75           name: awx-application-config
76           readOnly: true
77           subPath: settings.py
78         - mountPath: /etc/tower/conf.d/
79           name: awx-application-credentials
80           readOnly: true
81         - mountPath: /etc/tower/SECRET_KEY
82           name: awx-secret-key
83           readOnly: true
84           subPath: SECRET_KEY
85       - command: ["/bin/sh","-c"]
86         args: ["/usr/bin/launch_awx_task.sh"]
87         env:
88         - name: AWX_SKIP_MIGRATIONS
89           value: "1"
90
91         image: "{{ .Values.repository }}/{{ .Values.image.task }}"
92         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93         name: {{ include "common.name" . }}-celery
94         resources:
95           requests:
96             cpu: 1500m
97             memory: 2Gi
98         securityContext:
99           privileged: true
100         volumeMounts:
101         - mountPath: /etc/tower/settings.py
102           name: awx-application-config
103           readOnly: true
104           subPath: settings.py
105         - mountPath: /etc/tower/conf.d/
106           name: awx-application-credentials
107           readOnly: true
108         - mountPath: /etc/tower/SECRET_KEY
109           name: awx-secret-key
110           readOnly: true
111           subPath: SECRET_KEY
112       - env:
113         - name: MY_POD_IP
114           valueFrom:
115             fieldRef:
116               apiVersion: v1
117               fieldPath: status.podIP
118         - name: RABBITMQ_USE_LONGNAME
119           value: "true"
120         - name: RABBITMQ_NODENAME
121           value: rabbit@$(MY_POD_IP)
122         - name: RABBITMQ_ERLANG_COOKIE
123           valueFrom:
124             secretKeyRef:
125               key: rabbitmq_erlang_cookie
126               name: {{ include "common.fullname" . }}-secrets
127         - name: K8S_SERVICE_NAME
128           value: {{ include "common.servicename" . }}-rabbitmq
129
130         image: "{{ .Values.repository }}/{{ .Values.image.rabbitmq }}"
131         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
132         name: {{ include "common.name" . }}-rabbit
133         livenessProbe:
134           exec:
135             command:
136             - rabbitmqctl
137             - status
138           failureThreshold: 3
139           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
140           periodSeconds: {{ .Values.liveness.periodSeconds }}
141           successThreshold: 1
142           timeoutSeconds: 10
143         ports:
144         - containerPort: {{ .Values.service.rabbitmq.http.internalPort }}
145           name: {{ .Values.service.rabbitmq.http.portName }}
146           protocol: TCP
147         - containerPort: {{ .Values.service.rabbitmq.amqp.internalPort }}
148           name: {{ .Values.service.rabbitmq.amqp.portName }}
149           protocol: TCP
150         readinessProbe:
151           exec:
152             command:
153             - rabbitmqctl
154             - status
155           failureThreshold: 3
156           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
157           periodSeconds: {{ .Values.liveness.periodSeconds }}
158           successThreshold: 1
159           timeoutSeconds: 10
160         resources:
161           requests:
162             cpu: 500m
163             memory: 2Gi
164         volumeMounts:
165         - mountPath: /etc/rabbitmq
166           name: rabbitmq-config
167
168       - image: "{{ .Values.image.memcached }}"
169         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
170         name: {{ include "common.name" . }}-memcached
171         resources:
172           requests:
173             cpu: 500m
174             memory: 1Gi
175       serviceAccount: {{ include "common.fullname" . }}
176       serviceAccountName: {{ include "common.fullname" . }}
177       volumes:
178       - configMap:
179           defaultMode: 420
180           items:
181           - key: awx_settings
182             path: settings.py
183           name: {{ include "common.fullname" . }}-settings
184         name: awx-application-config
185       - name: awx-application-credentials
186         secret:
187           defaultMode: 420
188           items:
189           - key: credentials_py
190             path: credentials.py
191           - key: environment_sh
192             path: environment.sh
193           secretName: {{ include "common.fullname" . }}-secrets
194       - name: awx-secret-key
195         secret:
196           defaultMode: 420
197           items:
198           - key: secret_key
199             path: SECRET_KEY
200           secretName: {{ include "common.fullname" . }}-secrets
201       - configMap:
202           defaultMode: 420
203           items:
204           - key: rabbitmq.conf
205             path: rabbitmq.conf
206           - key: enabled_plugins
207             path: enabled_plugins
208           - key: rabbitmq_definitions.json
209             path: rabbitmq_definitions.json
210           name: {{ include "common.fullname" . }}-rabbitmq
211         name: rabbitmq-config
212       imagePullSecrets:
213       - name: "{{ include "common.namespace" . }}-docker-registry-key"