blob: 61877c38a057cec236b69321185afc66435220f4 [file] [log] [blame]
puthuparambil.aditya7625e522021-01-22 22:01:50 +01001{{/*
2# Copyright (C) 2021 Pantheon.tech, Orange
Bruno Sakotoc27240b2021-03-08 17:59:44 -05003# Modifications Copyright (C) 2021 Bell Canada.
Rishi.Chail7b307452021-03-05 12:11:01 +00004# Modifications Copyright (C) 2021 Nordix Foundation. All rights reserved.
puthuparambil.aditya7625e522021-01-22 22:01:50 +01005#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17*/}}
18
19apiVersion: apps/v1
20kind: Deployment
21metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
22spec:
23 replicas: {{ .Values.replicaCount }}
24 selector: {{- include "common.selectors" . | nindent 4 }}
25 template:
26 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
27 spec:
28 {{ include "common.podSecurityContext" . | indent 6 | trim}}
29 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
30 initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
31 - name: {{ include "common.name" . }}-update-config
32 image: {{ include "repositoryGenerator.image.envsubst" . }}
33 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
34 command:
35 - sh
36 args:
37 - -c
38 - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
39 env:
40 - name: DB_USERNAME
41 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 12 }}
42 - name: DB_PASSWORD
43 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 12 }}
Rishi.Chail7b307452021-03-05 12:11:01 +000044 - name: LIQUIBASE_LABELS
45 value: {{ .Values.config.liquibaseLabels }}
puthuparambil.adityaf9908a42021-04-12 15:29:38 +010046 - name: CPS_USERNAME
47 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 12 }}
48 - name: CPS_PASSWORD
49 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 12 }}
puthuparambil.aditya7625e522021-01-22 22:01:50 +010050 volumeMounts:
51 - mountPath: /config-input
52 name: init-data-input
53 - mountPath: /config
54 name: init-data
55 containers:
56 - name: {{ include "common.name" . }}
57 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
58 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
59 ports: {{ include "common.containerPorts" . | nindent 10 }}
60 {{ include "common.containerSecurityContext" . | indent 8 | trim }}
61 # disable liveness probe when breakpoints set in debugger
62 # so K8s doesn't restart unresponsive container
63 {{- if eq .Values.liveness.enabled true }}
64 livenessProbe:
65 httpGet:
66 port: {{ .Values.liveness.port }}
67 path: {{ .Values.liveness.path }}
68 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
69 periodSeconds: {{ .Values.liveness.periodSeconds }}
70 {{ end -}}
71 readinessProbe:
72 httpGet:
73 port: {{ .Values.readiness.port }}
74 path: {{ .Values.readiness.path }}
75 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
76 periodSeconds: {{ .Values.readiness.periodSeconds }}
Renu Kumari5a47eaf2021-04-12 08:36:27 -040077 env:
78 - name: SPRING_PROFILES_ACTIVE
79 value: {{ .Values.config.spring.profile }}
puthuparambil.aditya7625e522021-01-22 22:01:50 +010080 resources: {{ include "common.resources" . | nindent 10 }}
81 {{- if .Values.nodeSelector }}
82 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }}
83 {{- end }}
84 {{- if .Values.affinity }}
85 affinity: {{ toYaml .Values.affinity | nindent 12 }}
86 {{- end }}
87 volumeMounts:
Renu Kumari5a47eaf2021-04-12 08:36:27 -040088 - mountPath: /app/resources/application-helm.yml
89 subPath: application-helm.yml
puthuparambil.aditya7625e522021-01-22 22:01:50 +010090 name: init-data
91 - mountPath: /app/resources/logback.xml
92 subPath: logback.xml
93 name: init-data
94 - mountPath: /tmp
95 name: init-temp
96 volumes:
97 - name: init-data-input
98 configMap:
99 name: {{ include "common.fullname" . }}
100 - name: init-data
101 emptyDir:
102 medium: Memory
103 - name: init-temp
104 emptyDir: {}
105 imagePullSecrets:
106 - name: "{{ include "common.namespace" . }}-docker-registry-key"