Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / aaf / components / aaf-sms / templates / deployment.yaml
1 {{/*
2 # Copyright 2018 Intel Corporation, Inc
3 # Modifications © 2020 AT&T
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   replicas: {{ .Values.replicaCount }}
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 8 }}
40         # Currently intermediate certificate is not given by AAF CM so we need
41         # to give it "by hand"
42         {{- if .Values.global.aafEnabled }}
43         - name: {{ include "common.fullname" . }}-add-intermediate-cert
44           command:
45             - /bin/sh
46           args:
47             - -c
48             - |
49               cat /int-certs/intermediate_root_ca.pem >> {{ .Values.certInitializer.mountPath }}/local/org.onap.aaf-sms.crt
50           image: {{ include "repositoryGenerator.image.busybox" . }}
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 12 }}
53             - mountPath: /int-certs
54               name: {{ include "common.fullname" . }}-int-certs
55               readOnly: true
56         {{- end }}
57         - name: {{ include "common.fullname" . }}-fix-permission
58           command:
59             - /bin/sh
60           args:
61             - -c
62             - |
63               chmod -R 775 /sms/auth
64               chown -R 1000:1000 /sms/auth
65           image: {{ include "repositoryGenerator.image.busybox" . }}
66           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67           volumeMounts:
68             - mountPath: /sms/auth
69               name: {{ include "common.fullname" . }}-auth
70         - name: {{ include "common.name" . }}-readiness
71           image:  {{ include "repositoryGenerator.image.readiness" . }}
72           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
73           command:
74           - /app/ready.py
75           args:
76           - --container-name
77           - "aaf-sms-vault"
78           - --container-name
79           - "aaf-sms-vault-backend"
80           env:
81           - name: NAMESPACE
82             valueFrom:
83               fieldRef:
84                 apiVersion: v1
85                 fieldPath: metadata.namespace
86       containers:
87       - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
88         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
89         name: {{ include "common.name" . }}
90         command: ["/sms/bin/sms"]
91         workingDir: /sms/
92         ports:
93         - containerPort: {{ .Values.service.internalPort }}
94         {{- if eq .Values.liveness.enabled true }}
95         livenessProbe:
96           httpGet:
97             port: {{ .Values.service.internalPort }}
98             scheme: HTTPS
99             path: /v1/sms/quorum/status
100           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
101           periodSeconds: {{ .Values.liveness.periodSeconds }}
102         {{ end -}}
103         readinessProbe:
104           httpGet:
105             port: {{ .Values.service.internalPort }}
106             scheme: HTTPS
107             path: /v1/sms/quorum/status
108           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
109           periodSeconds: {{ .Values.readiness.periodSeconds }}
110         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
111           - mountPath: /etc/localtime
112             name: localtime
113             readOnly: true
114           - mountPath: /sms/smsconfig.json
115             name: {{ include "common.name" .}}
116             subPath: smsconfig.json
117           - mountPath: /sms/auth
118             name: {{ include "common.fullname" . }}-auth
119         resources:
120 {{ include "common.resources" . | indent 10 }}
121         {{- if .Values.nodeSelector }}
122         nodeSelector:
123 {{ toYaml .Values.nodeSelector | indent 10 }}
124         {{- end -}}
125         {{- if .Values.affinity }}
126         affinity:
127 {{ toYaml .Values.affinity | indent 10 }}
128         {{- end }}
129       volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
130       - name: localtime
131         hostPath:
132           path: /etc/localtime
133       - name : {{ include "common.name" . }}
134         configMap:
135           name: {{ include "common.fullname" . }}
136       {{- if .Values.global.aafEnabled }}
137       - name: {{ include "common.fullname" . }}-int-certs
138         secret:
139           secretName: {{ include "common.fullname" . }}-int-certs
140       {{- end }}
141       - name: {{ include "common.fullname" . }}-auth
142       {{- if .Values.persistence.enabled }}
143         persistentVolumeClaim:
144           claimName: {{ include "common.fullname" . }}
145       {{- else }}
146         emptyDir: {}
147       {{- end }}
148       imagePullSecrets:
149       - name: "{{ include "common.namespace" . }}-docker-registry-key"