[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / portal / components / portal-widget / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
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: apps/v1
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 "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       initContainers:
38       - name: {{ include "common.name" . }}-readiness
39         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
40         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
41         command:
42         - /app/ready.py
43         args:
44         - --container-name
45         - "portal-db"
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52       containers:
53       - name: {{ include "common.name" . }}
54         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         command:
57           - /start-wms.sh
58         ports:
59         - containerPort: {{ .Values.service.internalPort }}
60         {{- if eq .Values.liveness.enabled true }}
61         livenessProbe:
62           tcpSocket:
63             port: {{ .Values.service.internalPort }}
64           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
65           periodSeconds: {{ .Values.liveness.periodSeconds }}
66         {{ end -}}
67         readinessProbe:
68           tcpSocket:
69             port: {{ .Values.service.internalPort }}
70           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
71           periodSeconds: {{ .Values.readiness.periodSeconds }}
72         volumeMounts:
73         - mountPath: /etc/localtime
74           name: localtime
75           readOnly: true
76         - name: properties-onapwidgetms
77           mountPath: "/application.properties"
78           subPath: application.properties
79         - name: properties-onapwidgetms
80           mountPath: "/application.yml"
81           subPath: application.yml
82         resources:
83 {{ include "common.resources" . | indent 12 }}
84       {{- if .Values.nodeSelector }}
85       nodeSelector:
86 {{ toYaml .Values.nodeSelector | indent 10 }}
87       {{- end -}}
88       {{- if .Values.affinity }}
89       affinity:
90 {{ toYaml .Values.affinity | indent 10 }}
91       {{- end }}
92       volumes:
93         - name: localtime
94           hostPath:
95             path: /etc/localtime
96         - name: properties-onapwidgetms
97           configMap:
98             name: {{ include "common.fullname" . }}-onapwidgetms
99             defaultMode: 0755
100       imagePullSecrets:
101       - name: "{{ include "common.namespace" . }}-docker-registry-key"