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 }} |
| 26 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 27 | template: |
| 28 | metadata: |
| 29 | labels: |
| 30 | app.kubernetes.io/name: {{ include "common.name" . }} |
| 31 | app.kubernetes.io/instance: {{ include "common.release" . }} |
| 32 | {{- if .Values.prometheus.enabled }} |
| 33 | annotations: |
| 34 | prometheus.io/scrape: "true" |
| 35 | prometheus.io/path: 'manage/prometheus' |
| 36 | prometheus.io/port: {{ .Values.managementPort | quote }} |
| 37 | {{- end }} |
| 38 | 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 |
| 52 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "user-creds" "key" "login") | indent 12 }} |
| 53 | - name: DMI_PLUGIN_PASSWORD |
| 54 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "user-creds" "key" "password") | indent 12 }} |
| 55 | - 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 |
| 60 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "core-creds" "key" "login") | indent 12 }} |
| 61 | - name: CPS_CORE_PASSWORD |
| 62 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "core-creds" "key" "password") | indent 12 }} |
| 63 | 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 |
| 104 | - mountPath: /app/resources/logback.xml |
| 105 | subPath: logback.xml |
| 106 | name: init-data |
| 107 | - mountPath: /tmp |
| 108 | name: init-temp |
| 109 | volumes: |
| 110 | - name: init-data-input |
| 111 | configMap: |
| 112 | name: {{ include "common.fullname" . }} |
| 113 | - name: init-data |
| 114 | emptyDir: |
| 115 | medium: Memory |
| 116 | - name: init-temp |
| 117 | emptyDir: {} |
| 118 | imagePullSecrets: |
| 119 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |