84f699763933f9ed22e431864cb2d0c21a7a22ee
[oom.git] / kubernetes / aai / templates / deployment.yaml
1 # Copyright © 2018 Amdocs, Bell Canada, AT&T
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
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 "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ .Release.Name }}
33       name: {{ .Release.Name }}
34     spec:
35       initContainers:
36       - command:
37         - /root/ready.py
38         args:
39         - --container-name
40         - aai-traversal
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         name: {{ include "common.name" . }}-readiness
50       containers:
51       - name: {{ include "common.name" . }}
52         image: "{{ .Values.global.dockerhubRepository | default .Values.dockerhubRepository }}/{{ .Values.image }}"
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         volumeMounts:
55         - mountPath: /etc/localtime
56           name: localtime
57           readOnly: true
58         - mountPath: /dev/log
59           name: aai-service-log
60         - mountPath: /usr/local/etc/haproxy/haproxy.cfg
61           subPath: haproxy.cfg
62           name: haproxy-cfg
63         ports:
64         - containerPort: {{ .Values.service.internalPort }}
65         - containerPort: {{ .Values.service.internalPort2 }}
66         # disable liveness probe when breakpoints set in debugger
67         # so K8s doesn't restart unresponsive container
68         {{- if eq .Values.liveness.enabled true }}
69         livenessProbe:
70           tcpSocket:
71             port: {{ .Values.service.internalPort2 }}
72           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
73           periodSeconds: {{ .Values.liveness.periodSeconds }}
74         {{ end -}}
75         readinessProbe:
76           tcpSocket:
77             port: {{ .Values.service.internalPort2 }}
78           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
79           periodSeconds: {{ .Values.readiness.periodSeconds }}
80         resources:
81 {{ toYaml .Values.resources | indent 12 }}
82       {{- if .Values.nodeSelector }}
83       nodeSelector:
84 {{ toYaml .Values.nodeSelector | indent 10 }}
85       {{- end -}}
86       {{- if .Values.affinity }}
87       affinity:
88 {{ toYaml .Values.affinity | indent 10 }}
89       {{- end }}
90
91       volumes:
92         - name: localtime
93           hostPath:
94             path: /etc/localtime
95         - name: aai-service-log
96           hostPath:
97             path: "/dev/log"
98         - name: haproxy-cfg
99           configMap:
100             name: aai-deployment-configmap
101       imagePullSecrets:
102       - name: "{{ include "common.namespace" . }}-docker-registry-key"