[AAI] Make AAI helm3 compatible
[oom.git] / kubernetes / aai / templates / deployment.yaml
1 {{/*
2 # Copyright (c) 2018 Amdocs, Bell Canada, AT&T
3 # Modifications Copyright (c) 2020 Nokia, Orange
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   replicas: {{ .Values.replicaCount }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38       name: {{ include "common.release" . }}
39       annotations:
40         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
41     spec:
42       initContainers:
43       - command:
44         - /app/ready.py
45         args:
46         - --container-name
47         - aai-resources
48         - --container-name
49         - aai-traversal
50         - --container-name
51         - aai-graphadmin
52         env:
53         - name: NAMESPACE
54           valueFrom:
55             fieldRef:
56               apiVersion: v1
57               fieldPath: metadata.namespace
58         image: {{ include "repositoryGenerator.image.readiness" . }}
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         name: {{ include "common.name" . }}-readiness
61       containers:
62       - name: {{ include "common.name" . }}
63         image: "{{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}"
64         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65         volumeMounts:
66         - mountPath: /etc/localtime
67           name: localtime
68           readOnly: true
69         - mountPath: /dev/log
70           name: aai-service-log
71         - mountPath: /usr/local/etc/haproxy/haproxy.cfg
72         {{ if .Values.global.installSidecarSecurity }}
73           subPath: haproxy-pluggable-security.cfg
74         {{ else }}
75           subPath: haproxy.cfg
76         {{ end }}
77           name: haproxy-cfg
78         - mountPath: /etc/ssl/private/aai.pem
79           name: aai-pem
80           subPath: aai.pem
81         ports:
82         - containerPort: {{ .Values.service.internalPort }}
83         # disable liveness probe when breakpoints set in debugger
84         # so K8s doesn't restart unresponsive container
85         {{- if eq .Values.liveness.enabled true }}
86         livenessProbe:
87           tcpSocket:
88             port: {{ .Values.service.internalPort }}
89           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
90           periodSeconds: {{ .Values.liveness.periodSeconds }}
91         {{ end -}}
92         readinessProbe:
93           httpGet:
94             path: /aai/util/echo
95             port: {{ .Values.service.internalPort }}
96             scheme: HTTPS
97             httpHeaders:
98             - name: X-FromAppId
99               value: OOM_ReadinessCheck
100       {{ if .Values.global.installSidecarSecurity }}
101             - name: Authorization
102               value: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==
103       {{ end }}
104             - name: X-TransactionId
105               value: OOM_ReadinessCheck_TID
106             - name: Accept
107               value: application/json
108           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
109           periodSeconds: {{ .Values.readiness.periodSeconds }}
110         resources:
111 {{ include "common.resources" . }}
112       {{- if .Values.nodeSelector }}
113       nodeSelector:
114 {{ toYaml .Values.nodeSelector | indent 8 }}
115       {{- end -}}
116       {{- if .Values.affinity }}
117       affinity:
118 {{ toYaml .Values.affinity | indent 8 }}
119       {{- end }}
120
121       volumes:
122         - name: localtime
123           hostPath:
124             path: /etc/localtime
125         - name: aai-service-log
126           hostPath:
127             path: "/dev/log"
128         - name: haproxy-cfg
129           configMap:
130             name: aai-deployment-configmap
131         - name: aai-pem
132           secret:
133             secretName: aai-haproxy-secret
134       imagePullSecrets:
135       - name: "{{ include "common.namespace" . }}-docker-registry-key"