Merge "Switch policy/api rest port from cluster to node"
[oom.git] / kubernetes / so / charts / so-mariadb / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
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.name" . }}
21     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
22     release: {{ .Release.Name }}
23     heritage: {{ .Release.Service }}
24 spec:
25   replicas: {{ .Values.replicaCount }}
26   template:
27     metadata:
28       labels:
29         app: {{ include "common.name" . }}
30         release: {{ .Release.Name }}
31     spec:
32       hostname: mariadb
33       initContainers:
34       - name: {{ include "common.name" . }}-inject-testlab-project
35         command:
36         - /bin/bash
37         - -c
38         - >
39           git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit;
40           echo "Clone complete. Copying from /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d to /docker-entrypoint-initdb.d";
41           cp -rf /tmp/gerrit/volumes/mariadb/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d;
42           chmod -R 755 /docker-entrypoint-initdb.d;
43           echo "Done.";
44         image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.ubuntuInitImage }}"
45         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46         volumeMounts:
47         - name: docker-entrypoint-initdb-d
48           mountPath: "/docker-entrypoint-initdb.d"
49       containers:
50       - name: {{ include "common.name" . }}
51         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
52         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53         ports:
54         - containerPort: {{ .Values.service.internalPort }}
55         {{ if eq .Values.liveness.enabled true }}
56         livenessProbe:
57           tcpSocket:
58             port: {{ .Values.service.internalPort }}
59           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60           periodSeconds: {{ .Values.liveness.periodSeconds }}
61         {{ end }}
62         readinessProbe:
63           tcpSocket:
64             port: {{ .Values.service.internalPort }}
65           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
66           periodSeconds: {{ .Values.readiness.periodSeconds }}
67         env:
68           - name: MYSQL_ROOT_PASSWORD
69             valueFrom:
70               secretKeyRef:
71                 name: {{ template "common.fullname" . }}
72                 key: db-root-password
73         volumeMounts:
74         - mountPath: /var/lib/mysql
75           name: mariadb-data
76         - mountPath: /etc/localtime
77           name: localtime
78           readOnly: true
79         - mountPath: /etc/mysql/conf.d
80           name: mariadb-conf
81         - name: docker-entrypoint-initdb-d
82           mountPath: "/docker-entrypoint-initdb.d"
83         resources:
84 {{ include "common.resources" . | indent 12 }}
85       {{- if .Values.nodeSelector }}
86       nodeSelector:
87 {{ toYaml .Values.nodeSelector | indent 10 }}
88       {{- end -}}
89       {{- if .Values.affinity }}
90       affinity:
91 {{ toYaml .Values.affinity | indent 10 }}
92       {{- end }}
93       volumes:
94       - name: mariadb-data
95       {{- if .Values.persistence.enabled }}
96         persistentVolumeClaim:
97           claimName: {{ include "common.fullname" . }}
98       {{- else }}
99         emptyDir: {}
100       {{- end }}
101       - name: mariadb-conf
102         configMap:
103           name: confd-configmap
104       - name: localtime
105         hostPath:
106           path: /etc/localtime
107       - name: docker-entrypoint-initdb-d
108         emptyDir: {}
109       imagePullSecrets:
110       - name: "{{ include "common.namespace" . }}-docker-registry-key"