[SO] Cleanup of SO charts
[oom.git] / kubernetes / so / components / so-cnf-adapter / templates / deployment.yaml
1 {{/*
2 # Copyright © 2020 Huawei Technologies Co., Ltd.
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
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20 spec:
21   selector: {{- include "common.selectors" . | nindent 4 }}
22   replicas: {{ index .Values.replicaCount }}
23   minReadySeconds: {{ index .Values.minReadySeconds }}
24   strategy:
25     type: {{ index .Values.updateStrategy.type }}
26     rollingUpdate:
27       maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
28       maxSurge: {{ index .Values.updateStrategy.maxSurge }}
29   template:
30     metadata:
31       labels: {{- include "common.labels" . | nindent 8 }}
32     spec:
33       initContainers:
34         - name: {{ include "common.name" . }}-encrypter
35           command:
36             - sh
37           args:
38             - -c
39             - |
40               java Crypto "${AAI_USERNAME}:${AAI_PASSWORD}" "${MSO_KEY}" > /output/.aai_creds
41           env:
42             - name: AAI_USERNAME
43               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-aai-creds" "key" "login") | indent 14 }}
44             - name: AAI_PASSWORD
45               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-aai-creds" "key" "password") | indent 14 }}
46             - name: MSO_KEY
47               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cnf-adapter-mso-key" "key" "password") | indent 14 }}
48           image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.global.soCryptoImage }}
49           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50           volumeMounts:
51             - name: encoder
52               mountPath: /output
53         {{ include "common.readinessCheck.waitFor" . | indent 8 | trim }}
54       containers:
55         - name: {{ include "common.name" . }}
56           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
57           command:
58             - sh
59           args:
60             - -c
61             - |
62               export AAI_AUTH=$(cat /input/.aai_creds)
63               ./start-app.sh
64           resources: {{ include "common.resources" . | nindent 12 }}
65           ports: {{- include "common.containerPorts" . | nindent 12  }}
66           env:
67             - name: ACTUATOR_USERNAME
68               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "login") | indent 14 }}
69             - name: ACTUATOR_PASSWORD
70               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "password") | indent 14 }}
71           envFrom:
72             - configMapRef:
73                 name: {{ include "common.fullname" . }}-env
74           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
75           volumeMounts:
76             - name: logs
77               mountPath: /app/logs
78             - name: config
79               mountPath: /app/config
80               readOnly: true
81               readOnly: true
82             - name: encoder
83               mountPath: /input
84           livenessProbe:
85             httpGet:
86               path: {{ index .Values.livenessProbe.path}}
87               port: {{ index .Values.containerPort }}
88               scheme: {{ index .Values.livenessProbe.scheme}}
89             initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
90             periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
91             timeoutSeconds: {{ index .Values.livenessProbe.timeoutSeconds}}
92             successThreshold: {{ index .Values.livenessProbe.successThreshold}}
93             failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
94       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
95       volumes:
96         - name: logs
97           emptyDir: {}
98         - name: config
99           configMap:
100             name: {{ include "common.fullname" . }}
101         - name: encoder
102           emptyDir:
103             medium: Memory
104       imagePullSecrets:
105         - name: "{{ include "common.namespace" . }}-docker-registry-key"