blob: f5969738f6fc00f84a40eb3f2a5a4b951889ff1e [file] [log] [blame]
rope252cd2142c2018-09-17 12:35:36 +01001# ============LICENSE_START=======================================================
2# Copyright (C) 2018 Ericsson. All rights reserved.
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# SPDX-License-Identifier: Apache-2.0
17# ============LICENSE_END=========================================================
18# @author: gareth.roper@ericsson.com
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020019apiVersion: apps/v1
rope252cd2142c2018-09-17 12:35:36 +010020kind: Deployment
21metadata:
22 name: {{ include "common.fullname" . }}
23 namespace: {{ include "common.namespace" . }}
24 labels:
25 app: {{ include "common.fullname" . }}
26 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010027 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010028spec:
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020029 selector:
30 matchLabels:
31 app: {{ include "common.name" . }}
rope252cd2142c2018-09-17 12:35:36 +010032 replicas: {{ index .Values.replicaCount }}
33 minReadySeconds: {{ index .Values.minReadySeconds }}
34 strategy:
35 type: {{ index .Values.updateStrategy.type }}
36 rollingUpdate:
37 maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
38 maxSurge: {{ index .Values.updateStrategy.maxSurge }}
39 template:
40 metadata:
41 labels:
42 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010043 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010044 spec:
seshukm0df1f8e2020-08-17 21:45:49 +053045 initContainers:
rope252cd2142c2018-09-17 12:35:36 +010046 - name: so-chown
47 image: alpine:3.6
48 volumeMounts:
49 - name: logs
50 mountPath: /app/logs
jmacc4f04d32018-10-12 18:24:24 +000051 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
rope252cd2142c2018-09-17 12:35:36 +010052 command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"]
53 restartPolicy: Always
54 containers:
55 - name: {{ include "common.name" . }}
56 image: {{ include "common.repository" . }}/{{ .Values.image }}
seshukm0df1f8e2020-08-17 21:45:49 +053057 resources: {{ include "common.resources" . | nindent 12 }}
rope252cd2142c2018-09-17 12:35:36 +010058 env:
59 - name: DB_HOST
60 valueFrom:
61 secretKeyRef:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010062 name: {{ include "common.release" . }}-so-db-secrets
rope252cd2142c2018-09-17 12:35:36 +010063 key: mariadb.readwrite.host
64 - name: DB_PORT
65 valueFrom:
66 secretKeyRef:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010067 name: {{ include "common.release" . }}-so-db-secrets
rope252cd2142c2018-09-17 12:35:36 +010068 key: mariadb.readwrite.port
69 - name: DB_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010070 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010071 - name: DB_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010072 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010073 - name: DB_ADMIN_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010074 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010075 - name: DB_ADMIN_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010076 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010077 envFrom:
78 - configMapRef:
79 name: {{ include "common.fullname" . }}-configmap
jmacc4f04d32018-10-12 18:24:24 +000080 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
seshukm0df1f8e2020-08-17 21:45:49 +053081 volumeMounts:
rope252cd2142c2018-09-17 12:35:36 +010082 - name: logs
83 mountPath: /app/logs
rope252cd2142c2018-09-17 12:35:36 +010084 - name: config
85 mountPath: /app/config
86 readOnly: true
87 readinessProbe:
88 tcpSocket:
89 port: {{ index .Values.readinessProbe.port }}
90 initialDelaySeconds: {{ index .Values.readinessProbe.initialDelaySeconds}}
91 periodSeconds: {{ index .Values.readinessProbe.periodSeconds}}
92 livenessProbe:
93 tcpSocket:
94 port: {{ index .Values.livenessProbe.port }}
95 initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
96 periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
97 successThreshold: {{ index .Values.livenessProbe.successThreshold}}
98 failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
99
100 ports:
101 - containerPort: {{ index .Values.containerPort }}
102 name: {{ .Values.service.portName }}
103 protocol: TCP
seshukm0df1f8e2020-08-17 21:45:49 +0530104 volumes:
rope252cd2142c2018-09-17 12:35:36 +0100105 - name: logs
106 emptyDir: {}
rope252cd2142c2018-09-17 12:35:36 +0100107 - name: config
108 configMap:
109 name: {{ include "common.fullname" . }}-app-configmap
110 imagePullSecrets:
111 - name: "{{ include "common.namespace" . }}-docker-registry-key"