Merge "Upgrade APPC to use common mariadb galera charts"
[oom.git] / kubernetes / so / charts / so-sdc-controller / templates / deployment.yaml
1 # Copyright © 2018 AT&T USA
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 apiVersion: extensions/v1beta1
15 kind: Deployment
16 metadata:
17   name: {{ include "common.fullname" . }}
18   namespace: {{ include "common.namespace" . }}
19   labels:
20     app: {{ include "common.fullname" . }}
21     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
22     release: {{ .Release.Name }}
23 spec:
24   replicas: {{ index .Values.replicaCount }}
25   minReadySeconds: {{ index .Values.minReadySeconds }}
26   strategy:
27     type: {{ index .Values.updateStrategy.type }}
28     rollingUpdate:
29       maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
30       maxSurge: {{ index .Values.updateStrategy.maxSurge }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ .Release.Name }}
36     spec:
37       initContainers:
38       - name: so-chown
39         image: alpine:3.6
40         volumeMounts:
41         - name: logs
42           mountPath: /app/logs
43         imagePullPolicy: {{ index .Values.pullPolicy }}
44         command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"]
45       restartPolicy: Always
46       containers:
47       - name: {{ include "common.name" . }}
48         image: {{ include "common.repository" . }}/{{ .Values.image }}
49         resources:
50 {{ toYaml (pluck .Values.flavor .Values.resources| first) | indent 12 }}
51         env:
52         - name: DB_HOST
53           valueFrom:
54             secretKeyRef:
55               name: {{ .Release.Name}}-so-db-secrets
56               key: mariadb.readwrite.host
57         - name: DB_PORT
58           valueFrom:
59             secretKeyRef:
60               name: {{ .Release.Name}}-so-db-secrets
61               key: mariadb.readwrite.port
62         - name: DB_USERNAME
63           valueFrom:
64             secretKeyRef:
65               name: {{ .Release.Name}}-so-db-secrets
66               key: mariadb.readwrite.rolename
67         - name: DB_PASSWORD
68           valueFrom:
69             secretKeyRef:
70               name: {{ .Release.Name}}-so-db-secrets
71               key: mariadb.readwrite.password
72         - name: DB_ADMIN_USERNAME
73           valueFrom:
74             secretKeyRef:
75               name: {{ .Release.Name}}-so-db-secrets
76               key: mariadb.admin.rolename
77         - name: DB_ADMIN_PASSWORD
78           valueFrom:
79             secretKeyRef:
80               name: {{ .Release.Name}}-so-db-secrets
81               key: mariadb.admin.password
82         - name: CADI_KEYSTORE_PASSWORD
83           valueFrom:
84             secretKeyRef:
85               name: {{ .Release.Name}}-so-ssl-pwd-secret
86               key: cadi_keystore_password
87         - name: CADI_TRUSTSTORE_PASSWORD
88           valueFrom:
89             secretKeyRef:
90               name: {{ .Release.Name}}-so-ssl-pwd-secret
91               key: cadi_truststore_password
92         - name: MSO_KEYSTORE_PASSWORD
93           valueFrom:
94             secretKeyRef:
95               name: {{ .Release.Name}}-so-ssl-client-secret
96               key: keystore_password
97         - name: MSO_TRUSTSTORE_PASSWORD
98           valueFrom:
99             secretKeyRef:
100               name: {{ .Release.Name}}-so-ssl-client-secret
101               key: truststore_password
102         envFrom:
103         - configMapRef:
104             name: {{ include "common.fullname" . }}-configmap
105         imagePullPolicy:  {{ index .Values "global" "pullPolicy" }}
106         volumeMounts:
107         - name: logs
108           mountPath: /app/logs
109         - name: certs
110           mountPath: /app/certs/
111           readOnly: true
112         - name: config
113           mountPath: /app/config
114           readOnly: true
115         livenessProbe:
116           httpGet:
117             path: {{- index .Values.livenessProbe.path|indent 2}}
118             port: {{ index .Values.containerPort }}
119             scheme: {{- index .Values.livenessProbe.scheme| indent 2}}
120           initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
121           periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
122           timeoutSeconds: {{ index .Values.livenessProbe.timeoutSeconds}}
123           successThreshold: {{ index .Values.livenessProbe.successThreshold}}
124           failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
125         ports:
126         - containerPort: {{ index .Values.containerPort }}
127           name: {{ .Values.service.portName }}
128           protocol: TCP
129       volumes:
130       - name: logs
131         emptyDir: {}
132       - name: certs
133         secret:
134             secretName: {{ .Release.Name}}-so-ssl-secret
135       - name: config
136         configMap:
137             name: {{ include "common.fullname" . }}-app-configmap
138       imagePullSecrets:
139         - name: "{{ include "common.namespace" . }}-docker-registry-key"