Merge "default storageclass and nfs provisioner"
[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       annotations:
35         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
36     spec:
37       initContainers:
38       - command:
39         - /root/ready.py
40         args:
41         - --container-name
42         - aai-resources
43         - --container-name
44         - aai-traversal
45         - --container-name
46         - aai-graphadmin
47         env:
48         - name: NAMESPACE
49           valueFrom:
50             fieldRef:
51               apiVersion: v1
52               fieldPath: metadata.namespace
53         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         name: {{ include "common.name" . }}-readiness
56       containers:
57       - name: {{ include "common.name" . }}
58         image: "{{ .Values.global.dockerhubRepository | default .Values.dockerhubRepository }}/{{ .Values.image }}"
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         volumeMounts:
61         - mountPath: /etc/localtime
62           name: localtime
63           readOnly: true
64         - mountPath: /dev/log
65           name: aai-service-log
66         - mountPath: /usr/local/etc/haproxy/haproxy.cfg
67         {{ if .Values.global.installSidecarSecurity }}
68           subPath: haproxy-pluggable-security.cfg
69         {{ else }}
70           subPath: haproxy.cfg
71         {{ end }}
72           name: haproxy-cfg
73         - mountPath: /etc/ssl/private/aai.pem
74           name: aai-pem
75           subPath: aai.pem
76         ports:
77         - containerPort: {{ .Values.service.internalPort }}
78         - containerPort: {{ .Values.service.internalPort2 }}
79         # disable liveness probe when breakpoints set in debugger
80         # so K8s doesn't restart unresponsive container
81         {{- if eq .Values.liveness.enabled true }}
82         livenessProbe:
83           tcpSocket:
84             port: {{ .Values.service.internalPort2 }}
85           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86           periodSeconds: {{ .Values.liveness.periodSeconds }}
87         {{ end -}}
88         readinessProbe:
89           httpGet:
90             path: /aai/util/echo
91             port: {{ .Values.service.internalPort2 }}
92             scheme: HTTPS
93             httpHeaders:
94             - name: X-FromAppId
95               value: OOM_ReadinessCheck
96       {{ if .Values.global.installSidecarSecurity }}
97             - name: Authorization
98               value: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==
99       {{ end }}
100             - name: X-TransactionId
101               value: {{ uuidv4 }}
102             - name: Accept
103               value: application/json
104           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
105           periodSeconds: {{ .Values.readiness.periodSeconds }}
106         resources:
107 {{ include "common.resources" . }}
108       {{- if .Values.nodeSelector }}
109       nodeSelector:
110 {{ toYaml .Values.nodeSelector | indent 8 }}
111       {{- end -}}
112       {{- if .Values.affinity }}
113       affinity:
114 {{ toYaml .Values.affinity | indent 8 }}
115       {{- end }}
116
117       volumes:
118         - name: localtime
119           hostPath:
120             path: /etc/localtime
121         - name: aai-service-log
122           hostPath:
123             path: "/dev/log"
124         - name: haproxy-cfg
125           configMap:
126             name: aai-deployment-configmap
127         - name: aai-pem
128           secret:
129             secretName: aai-haproxy-secret
130       imagePullSecrets:
131       - name: "{{ include "common.namespace" . }}-docker-registry-key"