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