shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 1 | {{/* |
| 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 | |
| 21 | apiVersion: apps/v1 |
| 22 | kind: Deployment |
| 23 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 24 | spec: |
| 25 | replicas: {{ .Values.replicaCount }} |
Renu Kumari | bcacd77 | 2021-09-16 15:36:23 -0400 | [diff] [blame] | 26 | 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 }} |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 32 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 33 | template: |
Andreas Geissler | 95ea136 | 2023-07-18 20:27:56 +0200 | [diff] [blame] | 34 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 35 | spec: |
| 36 | {{ include "common.podSecurityContext" . | indent 6 | trim}} |
| 37 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }} |
| 38 | initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }} |
| 39 | - name: {{ include "common.name" . }}-update-config |
| 40 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
| 41 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 42 | command: |
| 43 | - sh |
| 44 | args: |
| 45 | - -c |
| 46 | - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done" |
| 47 | env: |
| 48 | - name: DMI_PLUGIN_USERNAME |
Renu Kumari | bcacd77 | 2021-09-16 15:36:23 -0400 | [diff] [blame] | 49 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 12 }} |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 50 | - name: DMI_PLUGIN_PASSWORD |
Renu Kumari | bcacd77 | 2021-09-16 15:36:23 -0400 | [diff] [blame] | 51 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 12 }} |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 52 | - name: SDNC_USERNAME |
| 53 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "login") | indent 12 }} |
| 54 | - name: SDNC_PASSWORD |
| 55 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "password") | indent 12 }} |
| 56 | - name: CPS_CORE_USERNAME |
Renu Kumari | bcacd77 | 2021-09-16 15:36:23 -0400 | [diff] [blame] | 57 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-core-creds" "key" "login") | indent 12 }} |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 58 | - name: CPS_CORE_PASSWORD |
Renu Kumari | bcacd77 | 2021-09-16 15:36:23 -0400 | [diff] [blame] | 59 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-core-creds" "key" "password") | indent 12 }} |
mpriyank | 9d4d923 | 2023-04-13 16:27:25 +0100 | [diff] [blame] | 60 | - name: SASL_JAAS_CONFIG |
| 61 | valueFrom: |
| 62 | secretKeyRef: |
| 63 | name: {{ include "common.name" . }}-ku |
| 64 | key: sasl.jaas.config |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 65 | volumeMounts: |
| 66 | - mountPath: /config-input |
| 67 | name: init-data-input |
| 68 | - mountPath: /config |
| 69 | name: init-data |
| 70 | containers: |
| 71 | - name: {{ include "common.name" . }} |
| 72 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
| 73 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 74 | ports: {{ include "common.containerPorts" . | nindent 10 }} |
| 75 | {{ include "common.containerSecurityContext" . | indent 8 | trim }} |
| 76 | # disable liveness probe when breakpoints set in debugger |
| 77 | # so K8s doesn't restart unresponsive container |
| 78 | {{- if eq .Values.liveness.enabled true }} |
| 79 | livenessProbe: |
| 80 | httpGet: |
| 81 | port: {{ .Values.liveness.port }} |
| 82 | path: {{ .Values.liveness.path }} |
| 83 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 84 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 85 | {{ end -}} |
| 86 | readinessProbe: |
| 87 | httpGet: |
| 88 | port: {{ .Values.readiness.port }} |
| 89 | path: {{ .Values.readiness.path }} |
| 90 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 91 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 92 | env: |
| 93 | - name: SPRING_PROFILES_ACTIVE |
| 94 | value: {{ .Values.config.spring.profile }} |
mpriyank | 9d4d923 | 2023-04-13 16:27:25 +0100 | [diff] [blame] | 95 | - name: SASL_JAAS_CONFIG |
| 96 | valueFrom: |
| 97 | secretKeyRef: |
| 98 | name: {{ include "common.name" . }}-ku |
| 99 | key: sasl.jaas.config |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 100 | resources: {{ include "common.resources" . | nindent 10 }} |
| 101 | {{- if .Values.nodeSelector }} |
| 102 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }} |
| 103 | {{- end }} |
| 104 | {{- if .Values.affinity }} |
| 105 | affinity: {{ toYaml .Values.affinity | nindent 12 }} |
| 106 | {{- end }} |
| 107 | volumeMounts: |
| 108 | - mountPath: /app/resources/application-helm.yml |
| 109 | subPath: application-helm.yml |
| 110 | name: init-data |
shivasubedi | c615a89 | 2021-08-24 13:17:07 +0100 | [diff] [blame] | 111 | - mountPath: /tmp |
| 112 | name: init-temp |
| 113 | volumes: |
| 114 | - name: init-data-input |
| 115 | configMap: |
| 116 | name: {{ include "common.fullname" . }} |
| 117 | - name: init-data |
| 118 | emptyDir: |
| 119 | medium: Memory |
| 120 | - name: init-temp |
| 121 | emptyDir: {} |
| 122 | imagePullSecrets: |
| 123 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |