blob: aea9e28001bcde4fdbb5862c2f459473ddd93ae5 [file] [log] [blame]
Jakub Latusek44f0fdd2020-10-21 13:36:29 +02001{{/*
rope252cd2142c2018-09-17 12:35:36 +01002# ============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
Jakub Latusek44f0fdd2020-10-21 13:36:29 +020020*/}}
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020021apiVersion: apps/v1
rope252cd2142c2018-09-17 12:35:36 +010022kind: Deployment
23metadata:
24 name: {{ include "common.fullname" . }}
25 namespace: {{ include "common.namespace" . }}
26 labels:
27 app: {{ include "common.fullname" . }}
28 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010029 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010030spec:
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020031 selector:
32 matchLabels:
33 app: {{ include "common.name" . }}
rope252cd2142c2018-09-17 12:35:36 +010034 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" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010045 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010046 spec:
seshukm0df1f8e2020-08-17 21:45:49 +053047 initContainers:
rope252cd2142c2018-09-17 12:35:36 +010048 - name: so-chown
49 image: alpine:3.6
50 volumeMounts:
51 - name: logs
52 mountPath: /app/logs
jmacc4f04d32018-10-12 18:24:24 +000053 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
rope252cd2142c2018-09-17 12:35:36 +010054 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 }}
seshukm0df1f8e2020-08-17 21:45:49 +053059 resources: {{ include "common.resources" . | nindent 12 }}
rope252cd2142c2018-09-17 12:35:36 +010060 env:
61 - name: DB_HOST
62 valueFrom:
63 secretKeyRef:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010064 name: {{ include "common.release" . }}-so-db-secrets
rope252cd2142c2018-09-17 12:35:36 +010065 key: mariadb.readwrite.host
66 - name: DB_PORT
67 valueFrom:
68 secretKeyRef:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010069 name: {{ include "common.release" . }}-so-db-secrets
rope252cd2142c2018-09-17 12:35:36 +010070 key: mariadb.readwrite.port
71 - name: DB_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010072 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010073 - name: DB_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010074 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010075 - name: DB_ADMIN_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010076 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010077 - name: DB_ADMIN_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010078 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010079 envFrom:
80 - configMapRef:
81 name: {{ include "common.fullname" . }}-configmap
jmacc4f04d32018-10-12 18:24:24 +000082 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
seshukm0df1f8e2020-08-17 21:45:49 +053083 volumeMounts:
rope252cd2142c2018-09-17 12:35:36 +010084 - name: logs
85 mountPath: /app/logs
rope252cd2142c2018-09-17 12:35:36 +010086 - 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
seshukm0df1f8e2020-08-17 21:45:49 +0530106 volumes:
rope252cd2142c2018-09-17 12:35:36 +0100107 - name: logs
108 emptyDir: {}
rope252cd2142c2018-09-17 12:35:36 +0100109 - name: config
110 configMap:
111 name: {{ include "common.fullname" . }}-app-configmap
112 imagePullSecrets:
113 - name: "{{ include "common.namespace" . }}-docker-registry-key"