Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 1 | # Copyright (c) 2019 IBM, Bell Canada |
Krzysztof Opasiak | 32f9aaa | 2020-02-06 23:05:15 +0100 | [diff] [blame] | 2 | # Copyright (c) 2020 Samsung Electronics |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | apiVersion: extensions/v1beta1 |
| 17 | kind: Deployment |
| 18 | metadata: |
| 19 | name: {{ include "common.fullname" . }} |
| 20 | namespace: {{ include "common.namespace" . }} |
| 21 | labels: |
| 22 | app: {{ include "common.name" . }} |
| 23 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 24 | release: {{ include "common.release" . }} |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 25 | heritage: {{ .Release.Service }} |
| 26 | spec: |
| 27 | replicas: {{ .Values.replicaCount }} |
Sebastien Premont-Tendland | b679d7b | 2020-02-17 11:32:15 -0500 | [diff] [blame] | 28 | strategy: |
| 29 | type: RollingUpdate |
| 30 | rollingUpdate: |
| 31 | # This allow a new pod to be ready before terminating the old one |
| 32 | # causing no downtime when replicas is set to 1 |
| 33 | maxUnavailable: 0 |
| 34 | |
| 35 | # maxSurge to 1 is very important for the hazelcast integration |
| 36 | # we only want one pod at a time to restart not multiple |
| 37 | # and break the hazelcast cluster. We should not use % maxSurge value |
| 38 | # ref : https://hazelcast.com/blog/rolling-upgrade-hazelcast-imdg-on-kubernetes/ |
| 39 | maxSurge: 1 |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 40 | template: |
| 41 | metadata: |
| 42 | labels: |
| 43 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 44 | release: {{ include "common.release" . }} |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 45 | spec: |
| 46 | initContainers: |
| 47 | - command: |
Krzysztof Opasiak | 32f9aaa | 2020-02-06 23:05:15 +0100 | [diff] [blame] | 48 | - sh |
| 49 | args: |
| 50 | - -c |
| 51 | - "cd /config-input && for PFILE in `ls -1 .`; do envsubst '${CDS_DB_USERNAME},${CDS_DB_PASSWORD},${CDS_DB_ROOT_PASSWORD}' <${PFILE} >/config/${PFILE}; done" |
| 52 | env: |
| 53 | - name: CDS_DB_USERNAME |
Krzysztof Opasiak | 28d194f | 2020-03-24 03:27:32 +0100 | [diff] [blame] | 54 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "login") | indent 10}} |
Krzysztof Opasiak | 32f9aaa | 2020-02-06 23:05:15 +0100 | [diff] [blame] | 55 | - name: CDS_DB_PASSWORD |
Krzysztof Opasiak | 28d194f | 2020-03-24 03:27:32 +0100 | [diff] [blame] | 56 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-user-creds" "key" "password") | indent 10}} |
Krzysztof Opasiak | 32f9aaa | 2020-02-06 23:05:15 +0100 | [diff] [blame] | 57 | - name: CDS_DB_ROOT_PASSWORD |
Krzysztof Opasiak | 28d194f | 2020-03-24 03:27:32 +0100 | [diff] [blame] | 58 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-db-root-pass" "key" "password") | indent 10}} |
Krzysztof Opasiak | 32f9aaa | 2020-02-06 23:05:15 +0100 | [diff] [blame] | 59 | |
| 60 | volumeMounts: |
| 61 | - mountPath: /config-input/application.properties |
| 62 | name: {{ include "common.fullname" . }}-config |
| 63 | subPath: application.properties |
| 64 | - mountPath: /config |
| 65 | name: processed-config |
| 66 | image: "{{ .Values.global.envsubstImage }}" |
| 67 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 68 | name: {{ include "common.name" . }}-update-config |
| 69 | |
| 70 | - command: |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 71 | - /root/ready.py |
| 72 | args: |
| 73 | - --container-name |
Alexis de Talhouët | 63df163 | 2019-03-20 08:17:58 -0400 | [diff] [blame] | 74 | - cds-db |
Prathamesh Morde | 93da127 | 2019-06-24 10:36:15 -0400 | [diff] [blame] | 75 | {{- if .Values.dmaapEnabled }} |
| 76 | - --container-name |
| 77 | - message-router |
| 78 | {{ end }} |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 79 | env: |
| 80 | - name: NAMESPACE |
| 81 | valueFrom: |
| 82 | fieldRef: |
| 83 | apiVersion: v1 |
| 84 | fieldPath: metadata.namespace |
| 85 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 86 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 87 | name: {{ include "common.name" . }}-readiness |
jananib | b38185a | 2020-04-23 19:33:45 +0530 | [diff] [blame^] | 88 | - name: fix-permission |
| 89 | command: |
| 90 | - chown |
| 91 | - -R |
| 92 | - 100:101 |
| 93 | - /opt/app/onap/blueprints/deploy |
| 94 | image: busybox:latest |
| 95 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 96 | volumeMounts: |
| 97 | - mountPath: {{ .Values.persistence.deployedBlueprint }} |
| 98 | name: {{ include "common.fullname" . }}-blueprints |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 99 | containers: |
| 100 | - name: {{ include "common.name" . }} |
| 101 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
| 102 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 103 | env: |
| 104 | - name: APP_CONFIG_HOME |
| 105 | value: {{ .Values.config.appConfigDir }} |
Sebastien Premont-Tendland | b679d7b | 2020-02-17 11:32:15 -0500 | [diff] [blame] | 106 | - name: USE_SCRIPT_COMPILE_CACHE |
| 107 | value: {{ .Values.config.useScriptCompileCache | quote }} |
| 108 | # Cluster should only be enabled when replicaCount is more than 2 and useScriptCompileCache is set to false otherwise it won't work properly |
| 109 | - name: CLUSTER_ENABLED |
| 110 | value: {{ if and (gt (int (.Values.replicaCount)) 2) (not .Values.config.useScriptCompileCache) }} {{ .Values.cluster.enabled | quote }} {{ else }} "false" {{ end }} |
| 111 | - name: CLUSTER_ID |
| 112 | value: {{ .Values.cluster.clusterName }} |
| 113 | - name: CLUSTER_NODE_ID |
| 114 | valueFrom: |
| 115 | fieldRef: |
| 116 | fieldPath: metadata.name |
| 117 | - name: CLUSTER_CONFIG_FILE |
| 118 | value: {{ .Values.config.appConfigDir }}/hazelcast.yaml |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 119 | ports: |
| 120 | - containerPort: {{ .Values.service.http.internalPort }} |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 121 | - containerPort: {{ .Values.service.grpc.internalPort }} |
Sebastien Premont-Tendland | b679d7b | 2020-02-17 11:32:15 -0500 | [diff] [blame] | 122 | - containerPort: {{ .Values.service.cluster.internalPort }} |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 123 | # disable liveness probe when breakpoints set in debugger |
| 124 | # so K8s doesn't restart unresponsive container |
| 125 | {{ if .Values.liveness.enabled }} |
| 126 | livenessProbe: |
| 127 | httpGet: |
Alexis de Talhouët | 892564f | 2019-07-17 08:15:07 -0400 | [diff] [blame] | 128 | path: /api/v1/execution-service/health-check |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 129 | port: {{ .Values.service.http.internalPort }} |
Munir Ahmad | 597db66 | 2019-03-26 08:17:11 -0400 | [diff] [blame] | 130 | httpHeaders: |
| 131 | - name: Authorization |
| 132 | value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 133 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 134 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
Oleg Mitsura | 3a62118 | 2019-10-09 12:40:11 -0400 | [diff] [blame] | 135 | timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 136 | {{ end }} |
| 137 | readinessProbe: |
| 138 | httpGet: |
Alexis de Talhouët | 892564f | 2019-07-17 08:15:07 -0400 | [diff] [blame] | 139 | path: /api/v1/execution-service/health-check |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 140 | port: {{ .Values.service.http.internalPort }} |
Munir Ahmad | 597db66 | 2019-03-26 08:17:11 -0400 | [diff] [blame] | 141 | httpHeaders: |
| 142 | - name: Authorization |
| 143 | value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== |
Oleg Mitsura | bad9934 | 2019-10-28 14:06:42 -0400 | [diff] [blame] | 144 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 145 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 146 | timeoutSeconds: {{ .Values.readiness.timeoutSeconds }} |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 147 | volumeMounts: |
| 148 | - mountPath: /etc/localtime |
| 149 | name: localtime |
| 150 | readOnly: true |
| 151 | - mountPath: {{ .Values.config.appConfigDir }}/application.properties |
Krzysztof Opasiak | 32f9aaa | 2020-02-06 23:05:15 +0100 | [diff] [blame] | 152 | name: processed-config |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 153 | subPath: application.properties |
Steve Siani | 3925d7f | 2020-03-14 12:15:50 -0400 | [diff] [blame] | 154 | - mountPath: {{ .Values.config.appConfigDir }}/error-messages_en.properties |
| 155 | name: {{ include "common.fullname" . }}-config |
| 156 | subPath: error-messages_en.properties |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 157 | - mountPath: {{ .Values.config.appConfigDir }}/logback.xml |
| 158 | name: {{ include "common.fullname" . }}-config |
| 159 | subPath: logback.xml |
Sebastien Premont-Tendland | b679d7b | 2020-02-17 11:32:15 -0500 | [diff] [blame] | 160 | - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml |
| 161 | name: {{ include "common.fullname" . }}-config |
| 162 | subPath: hazelcast.yaml |
Abdelmuhaimen Seaudi | 204c64e | 2019-07-25 19:04:01 +0000 | [diff] [blame] | 163 | |
| 164 | - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer |
| 165 | name: {{ include "common.fullname" . }}-config |
| 166 | subPath: ONAP_RootCA.cer |
| 167 | |
Alexis de Talhouët | 108e28f | 2019-04-14 18:54:56 -0400 | [diff] [blame] | 168 | - mountPath: {{ .Values.persistence.deployedBlueprint }} |
| 169 | name: {{ include "common.fullname" . }}-blueprints |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 170 | resources: |
| 171 | {{ include "common.resources" . | indent 12 }} |
| 172 | {{- if .Values.nodeSelector }} |
| 173 | nodeSelector: |
| 174 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 175 | {{- end -}} |
| 176 | {{- if .Values.affinity }} |
| 177 | affinity: |
| 178 | {{ toYaml .Values.affinity | indent 10 }} |
| 179 | {{- end }} |
| 180 | volumes: |
| 181 | - name: localtime |
| 182 | hostPath: |
| 183 | path: /etc/localtime |
| 184 | - name: {{ include "common.fullname" . }}-config |
| 185 | configMap: |
| 186 | name: {{ include "common.fullname" . }}-configmap |
| 187 | items: |
| 188 | - key: application.properties |
| 189 | path: application.properties |
Steve Siani | 3925d7f | 2020-03-14 12:15:50 -0400 | [diff] [blame] | 190 | - key: error-messages_en.properties |
| 191 | path: error-messages_en.properties |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 192 | - key: logback.xml |
| 193 | path: logback.xml |
Sebastien Premont-Tendland | b679d7b | 2020-02-17 11:32:15 -0500 | [diff] [blame] | 194 | - key: hazelcast.yaml |
| 195 | path: hazelcast.yaml |
Abdelmuhaimen Seaudi | a451fd6 | 2019-09-10 14:21:04 +0000 | [diff] [blame] | 196 | - key: ONAP_RootCA.cer |
| 197 | path: ONAP_RootCA.cer |
Alexis de Talhouët | 108e28f | 2019-04-14 18:54:56 -0400 | [diff] [blame] | 198 | - name: {{ include "common.fullname" . }}-blueprints |
| 199 | persistentVolumeClaim: |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 200 | claimName: {{ include "common.release" . }}-cds-blueprints |
Krzysztof Opasiak | 32f9aaa | 2020-02-06 23:05:15 +0100 | [diff] [blame] | 201 | - name: processed-config |
| 202 | emptyDir: |
| 203 | medium: Memory |
Steve Alphonse Siani | a1b6b0e | 2019-01-25 15:23:58 -0500 | [diff] [blame] | 204 | imagePullSecrets: |
| 205 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |