Merge "[UUI] Service Mesh Compliance for UUI"
[oom.git] / kubernetes / so / components / so-appc-orchestrator / templates / deployment.yaml
1 {{/*
2 # Copyright © 2020 AT&T USA
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: {{ include "so.certificate.container_importer" . | nindent 6 }}
34       - name: {{ include "common.name" . }}-pass-encoder
35         command:
36         - sh
37         args:
38         {{/* bcrypt plain text and convert to OpenBSD variant using sed */}}
39         - -c
40         - htpasswd -bnBC 10 "" "${ACTUATOR_PASSWORD}" | tr -d ':\n' | sed 's/\$2y/\$2a/' 1>/tmp/app/encoded;
41         env:
42         - name: ACTUATOR_PASSWORD
43           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "password") | indent 10 }}
44         image: {{ include "repositoryGenerator.image.htpasswd" . }}
45         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46         volumeMounts:
47         - name: encoder
48           mountPath: /tmp/app
49       containers:
50       - name: {{ include "common.name" . }}
51         command:
52           - sh
53         args:
54           - -c
55           - |
56             export ACTUATOR_PASSWORD="$(cat /tmp/app/encoded)"
57             {{- if .Values.global.aafEnabled }}
58             export $(cat {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0)
59             {{- if .Values.global.security.aaf.enabled }}
60             export KEYSTORE_PASSWORD="${cadi_keystore_password_p12}"
61             {{- end }}
62             {{- end }}
63             /app/start-app.sh
64         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
65         resources: {{ include "common.resources" . | nindent 12 }}
66         env:
67         - name: ACTUATOR_USERNAME
68           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "login") | indent 10 }}
69         {{ include "so.certificates.env" . | indent 8 | trim }}
70         envFrom:
71         - configMapRef:
72             name: {{ include "common.fullname" . }}-configmap
73         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74         ports: {{- include "common.containerPorts" . | nindent 10 }}
75         volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 8 }}
76         - name: logs
77           mountPath: /app/logs
78         - name: encoder
79           mountPath: /tmp/app
80         - name: config
81           mountPath: /app/config
82           readOnly: true
83 {{ include "so.helpers.livenessProbe" .| indent 8 }}
84       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
85       volumes: {{ include "so.certificate.volumes" . | nindent 6 }}
86       - name: logs
87         emptyDir: {}
88       - name: encoder
89         emptyDir:
90           medium: Memory
91       - name: config
92         configMap:
93           name: {{ include "common.fullname" . }}-app-configmap
94       imagePullSecrets:
95         - name: "{{ include "common.namespace" . }}-docker-registry-key"