blob: 749e9a4637c294d838cfb832c4bf4cfd563b73f5 [file] [log] [blame]
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -05001# 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
15apiVersion: extensions/v1beta1
16kind: Deployment
17metadata:
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 Opasiak137d7cc2020-01-24 23:49:11 +010023 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050024 heritage: {{ .Release.Service }}
25spec:
26 replicas: {{ .Values.replicaCount }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050027 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 Siania1b6b0e2019-01-25 15:23:58 -050039 template:
40 metadata:
41 labels:
42 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010043 release: {{ include "common.release" . }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050044 spec:
45 initContainers:
46 - command:
47 - /root/ready.py
48 args:
49 - --container-name
Alexis de Talhouët63df1632019-03-20 08:17:58 -040050 - cds-db
Prathamesh Morde93da1272019-06-24 10:36:15 -040051 {{- if .Values.dmaapEnabled }}
52 - --container-name
53 - message-router
54 {{ end }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050055 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-Tendlandb679d7b2020-02-17 11:32:15 -050071 - 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 Siania1b6b0e2019-01-25 15:23:58 -050084 ports:
85 - containerPort: {{ .Values.service.http.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050086 - containerPort: {{ .Values.service.grpc.internalPort }}
Sebastien Premont-Tendlandb679d7b2020-02-17 11:32:15 -050087 - containerPort: {{ .Values.service.cluster.internalPort }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050088 # 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ët892564f2019-07-17 08:15:07 -040093 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050094 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -040095 httpHeaders:
96 - name: Authorization
97 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -050098 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
99 periodSeconds: {{ .Values.liveness.periodSeconds }}
Oleg Mitsura3a621182019-10-09 12:40:11 -0400100 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500101 {{ end }}
102 readinessProbe:
103 httpGet:
Alexis de Talhouët892564f2019-07-17 08:15:07 -0400104 path: /api/v1/execution-service/health-check
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500105 port: {{ .Values.service.http.internalPort }}
Munir Ahmad597db662019-03-26 08:17:11 -0400106 httpHeaders:
107 - name: Authorization
108 value: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
Oleg Mitsurabad99342019-10-28 14:06:42 -0400109 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
110 periodSeconds: {{ .Values.readiness.periodSeconds }}
111 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500112 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-Tendlandb679d7b2020-02-17 11:32:15 -0500122 - mountPath: {{ .Values.config.appConfigDir }}/hazelcast.yaml
123 name: {{ include "common.fullname" . }}-config
124 subPath: hazelcast.yaml
Abdelmuhaimen Seaudi204c64e2019-07-25 19:04:01 +0000125
126 - mountPath: {{ .Values.config.appConfigDir }}/ONAP_RootCA.cer
127 name: {{ include "common.fullname" . }}-config
128 subPath: ONAP_RootCA.cer
129
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400130 - mountPath: {{ .Values.persistence.deployedBlueprint }}
131 name: {{ include "common.fullname" . }}-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500132 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-Tendlandb679d7b2020-02-17 11:32:15 -0500154 - key: hazelcast.yaml
155 path: hazelcast.yaml
Abdelmuhaimen Seaudia451fd62019-09-10 14:21:04 +0000156 - key: ONAP_RootCA.cer
157 path: ONAP_RootCA.cer
Alexis de Talhouët108e28f2019-04-14 18:54:56 -0400158 - name: {{ include "common.fullname" . }}-blueprints
159 persistentVolumeClaim:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100160 claimName: {{ include "common.release" . }}-cds-blueprints
Steve Alphonse Siania1b6b0e2019-01-25 15:23:58 -0500161 imagePullSecrets:
162 - name: "{{ include "common.namespace" . }}-docker-registry-key"