Merge "[SDNC] Update CertServiceClient"
[oom.git] / kubernetes / so / components / so-monitoring / templates / deployment.yaml
1 {{/*
2 #  ============LICENSE_START=======================================================
3 #   Copyright (C) 2018 Ericsson. All rights reserved.
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 #  SPDX-License-Identifier: Apache-2.0
18 #  ============LICENSE_END=========================================================
19 #  @author: gareth.roper@ericsson.com
20 */}}
21 apiVersion: apps/v1
22 kind: Deployment
23 metadata:
24   name: {{ include "common.fullname" . }}
25   namespace: {{ include "common.namespace" . }}
26   labels:
27     app: {{ include "common.fullname" . }}
28     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
29     release: {{ include "common.release" . }}
30 spec:
31   selector:
32     matchLabels:
33       app: {{ include "common.name" . }}
34   replicas: {{ index .Values.replicaCount }}
35   minReadySeconds: {{ index .Values.minReadySeconds }}
36   strategy:
37     type: {{ index .Values.updateStrategy.type }}
38     rollingUpdate:
39       maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
40       maxSurge: {{ index .Values.updateStrategy.maxSurge }}
41   template:
42     metadata:
43       labels:
44         app: {{ include "common.name" . }}
45         release: {{ include "common.release" . }}
46     spec:
47       initContainers:
48       - name: so-chown
49         image: alpine:3.6
50         volumeMounts:
51         - name: logs
52           mountPath: /app/logs
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"]
55       restartPolicy: Always
56       containers:
57       - name: {{ include "common.name" . }}
58         image: {{ include "common.repository" . }}/{{ .Values.image }}
59         resources: {{ include "common.resources" . | nindent 12 }}
60         env:
61         - name: DB_HOST
62           valueFrom:
63             secretKeyRef:
64               name: {{ include "common.release" . }}-so-db-secrets
65               key: mariadb.readwrite.host
66         - name: DB_PORT
67           valueFrom:
68             secretKeyRef:
69               name: {{ include "common.release" . }}-so-db-secrets
70               key: mariadb.readwrite.port
71         - name: DB_USERNAME
72           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
73         - name: DB_PASSWORD
74           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
75         - name: DB_ADMIN_USERNAME
76           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
77         - name: DB_ADMIN_PASSWORD
78           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
79         envFrom:
80         - configMapRef:
81             name: {{ include "common.fullname" . }}-configmap
82         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
83         volumeMounts:
84         - name: logs
85           mountPath: /app/logs
86         - name: config
87           mountPath: /app/config
88           readOnly: true
89         readinessProbe:
90           tcpSocket:
91             port: {{ index .Values.readinessProbe.port }}
92           initialDelaySeconds: {{ index .Values.readinessProbe.initialDelaySeconds}}
93           periodSeconds: {{ index .Values.readinessProbe.periodSeconds}}
94         livenessProbe:
95           tcpSocket:
96             port: {{ index .Values.livenessProbe.port }}
97           initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
98           periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
99           successThreshold: {{ index .Values.livenessProbe.successThreshold}}
100           failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
101
102         ports:
103         - containerPort: {{ index .Values.containerPort }}
104           name: {{ .Values.service.portName }}
105           protocol: TCP
106       volumes:
107       - name: logs
108         emptyDir: {}
109       - name: config
110         configMap:
111             name: {{ include "common.fullname" . }}-app-configmap
112       imagePullSecrets:
113         - name: "{{ include "common.namespace" . }}-docker-registry-key"