blob: 3d154dba64f3b84b1b1406fb4deeffd1944fc4ad [file] [log] [blame]
shivasubedic615a892021-08-24 13:17:07 +01001{{/*
2# ============LICENSE_START=======================================================
3# Copyright (C) 2021 Nordix Foundation
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*/}}
20
21apiVersion: apps/v1
22kind: Deployment
23metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
24spec:
25 replicas: {{ .Values.replicaCount }}
Renu Kumaribcacd772021-09-16 15:36:23 -040026 minReadySeconds: {{ index .Values.minReadySeconds }}
27 strategy:
28 type: {{ index .Values.updateStrategy.type }}
29 rollingUpdate:
30 maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
31 maxSurge: {{ index .Values.updateStrategy.maxSurge }}
shivasubedic615a892021-08-24 13:17:07 +010032 selector: {{- include "common.selectors" . | nindent 4 }}
33 template:
34 metadata:
35 labels:
36 app.kubernetes.io/name: {{ include "common.name" . }}
37 app.kubernetes.io/instance: {{ include "common.release" . }}
shivasubedic615a892021-08-24 13:17:07 +010038 spec:
39 {{ include "common.podSecurityContext" . | indent 6 | trim}}
40 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
41 initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
42 - name: {{ include "common.name" . }}-update-config
43 image: {{ include "repositoryGenerator.image.envsubst" . }}
44 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45 command:
46 - sh
47 args:
48 - -c
49 - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
50 env:
51 - name: DMI_PLUGIN_USERNAME
Renu Kumaribcacd772021-09-16 15:36:23 -040052 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 12 }}
shivasubedic615a892021-08-24 13:17:07 +010053 - name: DMI_PLUGIN_PASSWORD
Renu Kumaribcacd772021-09-16 15:36:23 -040054 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 12 }}
shivasubedic615a892021-08-24 13:17:07 +010055 - name: SDNC_USERNAME
56 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "login") | indent 12 }}
57 - name: SDNC_PASSWORD
58 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "password") | indent 12 }}
59 - name: CPS_CORE_USERNAME
Renu Kumaribcacd772021-09-16 15:36:23 -040060 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-core-creds" "key" "login") | indent 12 }}
shivasubedic615a892021-08-24 13:17:07 +010061 - name: CPS_CORE_PASSWORD
Renu Kumaribcacd772021-09-16 15:36:23 -040062 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-core-creds" "key" "password") | indent 12 }}
shivasubedic615a892021-08-24 13:17:07 +010063 volumeMounts:
64 - mountPath: /config-input
65 name: init-data-input
66 - mountPath: /config
67 name: init-data
68 containers:
69 - name: {{ include "common.name" . }}
70 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
71 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72 ports: {{ include "common.containerPorts" . | nindent 10 }}
73 {{ include "common.containerSecurityContext" . | indent 8 | trim }}
74 # disable liveness probe when breakpoints set in debugger
75 # so K8s doesn't restart unresponsive container
76 {{- if eq .Values.liveness.enabled true }}
77 livenessProbe:
78 httpGet:
79 port: {{ .Values.liveness.port }}
80 path: {{ .Values.liveness.path }}
81 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
82 periodSeconds: {{ .Values.liveness.periodSeconds }}
83 {{ end -}}
84 readinessProbe:
85 httpGet:
86 port: {{ .Values.readiness.port }}
87 path: {{ .Values.readiness.path }}
88 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
89 periodSeconds: {{ .Values.readiness.periodSeconds }}
90 env:
91 - name: SPRING_PROFILES_ACTIVE
92 value: {{ .Values.config.spring.profile }}
93 resources: {{ include "common.resources" . | nindent 10 }}
94 {{- if .Values.nodeSelector }}
95 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }}
96 {{- end }}
97 {{- if .Values.affinity }}
98 affinity: {{ toYaml .Values.affinity | nindent 12 }}
99 {{- end }}
100 volumeMounts:
101 - mountPath: /app/resources/application-helm.yml
102 subPath: application-helm.yml
103 name: init-data
shivasubedic615a892021-08-24 13:17:07 +0100104 - mountPath: /tmp
105 name: init-temp
106 volumes:
107 - name: init-data-input
108 configMap:
109 name: {{ include "common.fullname" . }}
110 - name: init-data
111 emptyDir:
112 medium: Memory
113 - name: init-temp
114 emptyDir: {}
115 imagePullSecrets:
116 - name: "{{ include "common.namespace" . }}-docker-registry-key"