Merge "[CONSUL] Add limits to consul chart."
[oom.git] / kubernetes / so / components / so-appc-orchestrator / templates / deployment.yaml
1 # Copyright © 2020 AT&T USA
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: apps/v1
16 kind: Deployment
17 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
18 spec:
19   selector: {{- include "common.selectors" . | nindent 4 }}
20   replicas: {{ index .Values.replicaCount }}
21   minReadySeconds: {{ index .Values.minReadySeconds }}
22   strategy:
23     type: {{ index .Values.updateStrategy.type }}
24     rollingUpdate:
25       maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
26       maxSurge: {{ index .Values.updateStrategy.maxSurge }}
27   template:
28     metadata:
29       labels: {{- include "common.labels" . | nindent 8 }}
30     spec:
31       initContainers: {{ include "so.certificate.container_importer" . | nindent 6 }}
32       - name: {{ include "common.name" . }}-pass-encoder
33         command:
34         - sh
35         args:
36         {{/* bcrypt plain text and convert to OpenBSD variant using sed */}}
37         - -c
38         - htpasswd -bnBC 10 "" "${ACTUATOR_PASSWORD}" | tr -d ':\n' | sed 's/\$2y/\$2a/' 1>/tmp/app/encoded;
39         env:
40         - name: ACTUATOR_PASSWORD
41           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "password") | indent 10 }}
42         image: {{ .Values.global.dockerHubRepository }}/{{ .Values.global.htpasswdImage }}
43         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44         volumeMounts:
45         - name: encoder
46           mountPath: /tmp/app
47       containers:
48       - name: {{ include "common.name" . }}
49         command:
50           - sh
51         args:
52           - -c
53           - |
54             export ACTUATOR_PASSWORD="$(cat /tmp/app/encoded)"
55             {{- if .Values.global.aafEnabled }}
56             export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0)
57             export TRUSTSTORE_PASSWORD="${cadi_truststore_password}"
58             {{- if .Values.global.security.aaf.enabled }}
59             export KEYSTORE_PASSWORD="${cadi_keystore_password}"
60             {{- end }}
61             {{- end }}
62             /app/start-app.sh
63         image: {{ include "common.repository" . }}/{{ .Values.image }}
64         resources: {{ include "common.resources" . | nindent 12 }}
65         env:
66         - name: ACTUATOR_USERNAME
67           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "login") | indent 10 }}
68         {{ include "so.certificates.env" . | indent 8 | trim }}
69         envFrom:
70         - configMapRef:
71             name: {{ include "common.fullname" . }}-configmap
72         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
73         ports: {{- include "common.containerPorts" . | nindent 10 }}
74         volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 8 }}
75         - name: logs
76           mountPath: /app/logs
77         - name: encoder
78           mountPath: /tmp/app
79         - name: config
80           mountPath: /app/config
81           readOnly: true
82 {{ include "so.helpers.livenessProbe" .| indent 8 }}
83       volumes: {{ include "so.certificate.volumes" . | nindent 6 }}
84       - name: logs
85         emptyDir: {}
86       - name: encoder
87         emptyDir:
88           medium: Memory
89       - name: config
90         configMap:
91           name: {{ include "common.fullname" . }}-app-configmap
92       imagePullSecrets:
93         - name: "{{ include "common.namespace" . }}-docker-registry-key"