GuangrongFu | cc1316b | 2021-02-03 17:29:08 +0800 | [diff] [blame] | 1 | {{/* |
| 2 | #============LICENSE_START======================================================== |
| 3 | # ================================================================================ |
| 4 | # Copyright (c) 2021 ZTE Intellectual Property. All rights reserved. |
| 5 | # ================================================================================ |
| 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 | # ============LICENSE_END========================================================= |
| 18 | */}} |
| 19 | |
| 20 | apiVersion: apps/v1 |
| 21 | kind: Deployment |
| 22 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 23 | spec: |
| 24 | replicas: 1 |
| 25 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 26 | template: |
| 27 | metadata: {{- include "common.templateMetadata" . | nindent 6 }} |
| 28 | spec: |
| 29 | initContainers: {{- include "common.certInitializer.initContainer" . | nindent 6 }} |
| 30 | - name: init-consul |
| 31 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.consulLoaderImage }} |
| 32 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 33 | args: |
| 34 | - --key |
| 35 | - holmes-engine-mgmt|/hemconfig/cfy.json |
| 36 | resources: {} |
| 37 | volumeMounts: |
| 38 | - mountPath: /hemconfig |
| 39 | name: {{ include "common.fullname" . }}-config |
| 40 | - name: {{ include "common.name" . }}-env-config |
| 41 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
| 42 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 43 | command: |
| 44 | - sh |
| 45 | args: |
| 46 | - -c |
| 47 | - "cd /hemconfig && for PFILE in `find . -type f -not -name '*.json'`; do envsubst < ${PFILE} > /config/${PFILE##*/}; done" |
| 48 | env: |
| 49 | - name: JDBC_USERNAME |
| 50 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} |
| 51 | - name: JDBC_PASSWORD |
| 52 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
| 53 | - name: DB_NAME |
| 54 | value: {{ .Values.config.pgConfig.dbName }} |
| 55 | - name: URL_JDBC |
| 56 | value: {{ .Values.config.pgConfig.dbHost }} |
| 57 | - name: DB_PORT |
| 58 | value: "{{ .Values.config.pgConfig.dbPort }}" |
| 59 | volumeMounts: |
| 60 | - mountPath: /hemconfig |
| 61 | name: {{ include "common.fullname" . }}-config |
| 62 | - mountPath: /config |
| 63 | name: {{ include "common.fullname" . }}-env-config |
| 64 | containers: |
| 65 | - name: {{ include "common.name" . }} |
| 66 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
| 67 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 68 | resources: {{ include "common.resources" . | nindent 10 }} |
| 69 | ports: {{ include "common.containerPorts" . | nindent 10 }} |
| 70 | volumeMounts: {{- include "common.certInitializer.volumeMount" . | nindent 8 }} |
| 71 | - name: {{ include "common.fullname" . }}-env-config |
| 72 | mountPath: /opt/hemconfig |
| 73 | # disable liveness probe when breakpoints set in debugger |
| 74 | # so K8s doesn't restart unresponsive container |
| 75 | {{- if eq .Values.liveness.enabled true }} |
| 76 | livenessProbe: |
| 77 | httpGet: |
| 78 | path: {{ .Values.liveness.path }} |
| 79 | port: {{ .Values.liveness.port }} |
| 80 | scheme: {{ .Values.liveness.scheme }} |
| 81 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 82 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 83 | {{- end }} |
| 84 | readinessProbe: |
| 85 | httpGet: |
| 86 | path: {{ .Values.readiness.path }} |
| 87 | port: {{ .Values.readiness.port }} |
| 88 | scheme: {{ .Values.readiness.scheme }} |
| 89 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 90 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 91 | failureThreshold: 1 |
| 92 | successThreshold: 1 |
| 93 | timeoutSeconds: 1 |
| 94 | env: |
| 95 | - name: CONSUL_HOST |
| 96 | value: consul-server.{{ include "common.namespace" . }} |
| 97 | - name: CONFIG_BINDING_SERVICE |
| 98 | value: config-binding-service |
| 99 | - name: msb_hostname |
| 100 | value: "msb-iag.onap" |
| 101 | - name: POD_IP |
| 102 | valueFrom: |
| 103 | fieldRef: |
| 104 | apiVersion: v1 |
| 105 | fieldPath: status.podIP |
| 106 | - name: PGPASSWORD |
| 107 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
| 108 | - name: JDBC_USERNAME |
| 109 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} |
| 110 | - name: JDBC_PASSWORD |
| 111 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
| 112 | - name: DB_NAME |
| 113 | value: {{ .Values.config.pgConfig.dbName }} |
| 114 | - name: URL_JDBC |
| 115 | value: {{ .Values.config.pgConfig.dbHost }} |
| 116 | - name: DB_PORT |
| 117 | value: "{{ .Values.config.pgConfig.dbPort }}" |
| 118 | volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }} |
| 119 | - name: {{ include "common.fullname" . }}-config |
| 120 | configMap: |
| 121 | defaultMode: 422 |
| 122 | name: {{ include "common.fullname" . }} |
| 123 | - name: {{ include "common.fullname" . }}-env-config |
| 124 | emptyDir: |
| 125 | medium: Memory |
| 126 | imagePullSecrets: |
| 127 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |