blob: 0d80b2a9ae4988cdd29301df092c18bea6a2ff6e [file] [log] [blame]
sekharhuawei2e799e92020-11-14 17:06:56 +05301{{/*
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
17apiVersion: apps/v1
18kind: Deployment
19metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20spec:
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: {{ include "so.certificate.container_importer" . | nindent 8 }}
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
Sylvain Desbureauxa2e32752020-12-08 18:03:50 +010053 {{ include "common.readinessCheck.waitFor" . | indent 8 | trim }}
sekharhuawei2e799e92020-11-14 17:06:56 +053054 containers:
55 - name: {{ include "common.name" . }}
56 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
57 command:
58 - sh
59 args:
60 - -c
61 - |
62 export AAF_BASE64=$(echo -n "${AAF_USERNAME}:${AAF_PASSWORD}" | base64)
63 export AAF_AUTH=$(echo "Basic ${AAF_BASE64}")
64 export AAI_AUTH=$(cat /input/.aai_creds)
65 {{- if .Values.global.aafEnabled }}
Sylvain Desbureauxfde94072021-03-19 15:06:41 +010066 export $(cat {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0)
sekharhuawei2e799e92020-11-14 17:06:56 +053067 {{- if .Values.global.security.aaf.enabled }}
68 export KEYSTORE_PASSWORD="${cadi_keystore_password}"
69 {{- end }}
70 {{- end }}
71 ./start-app.sh
72 resources: {{ include "common.resources" . | nindent 12 }}
73 ports: {{- include "common.containerPorts" . | nindent 12 }}
74 env:
75 - name: AAF_USERNAME
76 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-aaf-creds" "key" "login") | indent 14 }}
77 - name: AAF_PASSWORD
78 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "so-aaf-creds" "key" "password") | indent 14 }}
79 - name: ACTUATOR_USERNAME
80 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "login") | indent 14 }}
81 - name: ACTUATOR_PASSWORD
82 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "password") | indent 14 }}
83 {{ include "so.certificates.env" . | indent 12 | trim }}
84 envFrom:
85 - configMapRef:
86 name: {{ include "common.fullname" . }}-env
87 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
88 volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 12 }}
89 - name: logs
90 mountPath: /app/logs
91 - name: config
92 mountPath: /app/config
93 readOnly: true
94 readOnly: true
95 - name: encoder
96 mountPath: /input
97 livenessProbe:
98 httpGet:
99 path: {{ index .Values.livenessProbe.path}}
100 port: {{ index .Values.containerPort }}
101 scheme: {{ index .Values.livenessProbe.scheme}}
102 initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
103 periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
104 timeoutSeconds: {{ index .Values.livenessProbe.timeoutSeconds}}
105 successThreshold: {{ index .Values.livenessProbe.successThreshold}}
106 failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
107 volumes: {{ include "so.certificate.volumes" . | nindent 8 }}
108 - name: logs
109 emptyDir: {}
110 - name: config
111 configMap:
112 name: {{ include "common.fullname" . }}
113 - name: encoder
114 emptyDir:
115 medium: Memory
116 imagePullSecrets:
117 - name: "{{ include "common.namespace" . }}-docker-registry-key"