[DCAEMOD] Uses new tpls for repos / images
[oom.git] / kubernetes / clamp / components / clamp-mariadb / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   replicas: {{ .Values.replicaCount }}
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       containers:
40         - name: {{ include "common.name" .  }}
41           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
42           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43           ports:
44           - containerPort: {{ .Values.service.internalPort }}
45           # disable liveness probe when breakpoints set in debugger
46           # so K8s doesn't restart unresponsive container
47           {{- if eq .Values.liveness.enabled true }}
48           livenessProbe:
49             tcpSocket:
50               port: {{ .Values.service.internalPort }}
51             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
52             periodSeconds: {{ .Values.liveness.periodSeconds }}
53           {{ end -}}
54           readinessProbe:
55             tcpSocket:
56               port: {{ .Values.service.internalPort }}
57             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
58             periodSeconds: {{ .Values.readiness.periodSeconds }}
59           env:
60           - name: MYSQL_USER
61             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
62           - name: MYSQL_PASSWORD
63             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
64           - name: MYSQL_ROOT_PASSWORD
65             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-pass" "key" "password") | indent 12 }}
66           - name: MYSQL_DATABASE
67             value: {{ tpl .Values.db.databaseName .}}
68           volumeMounts:
69           - mountPath: /docker-entrypoint.sh
70             subPath: docker-entrypoint.sh
71             name: init-script
72           - mountPath: /etc/localtime
73             name: localtime
74             readOnly: true
75           - mountPath: /docker-entrypoint-initdb.d/
76             name: docker-entrypoint-bulkload
77           - mountPath: /etc/mysql/conf.d/conf1/
78             name:  clamp-mariadb-conf
79           - mountPath: /var/lib/mysql
80             name: clamp-mariadb-data
81           resources:
82 {{ include "common.resources" . | indent 12 }}
83         {{- if .Values.nodeSelector }}
84         nodeSelector:
85 {{ toYaml .Values.nodeSelector | indent 10 }}
86         {{- end -}}
87         {{- if .Values.affinity }}
88         affinity:
89 {{ toYaml .Values.affinity | indent 10 }}
90         {{- end }}
91       volumes:
92       {{- if .Values.persistence.enabled }}
93         - name: clamp-mariadb-data
94           persistentVolumeClaim:
95             claimName: {{ include "common.fullname" . }}
96       {{- else }}
97           emptyDir: {}
98       {{- end }}
99         - name: docker-entrypoint-bulkload
100           configMap:
101             name: clamp-entrypoint-bulkload-configmap
102         - name: clamp-mariadb-conf
103           configMap:
104             name: clamp-mariadb-conf-configmap
105         - name: localtime
106           hostPath:
107             path: /etc/localtime
108         - name: init-script
109           configMap:
110             name: {{ include "common.fullname" . }}
111             defaultMode: 0755
112       imagePullSecrets:
113       - name: "{{ include "common.namespace" . }}-docker-registry-key"