[CONSUL] Add limits to consul chart.
[oom.git] / kubernetes / so / charts / 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           - export ACTUATOR_PASSWORD="$(cat /tmp/app/encoded)"; ./start-app.sh
54         image: {{ include "common.repository" . }}/{{ .Values.image }}
55         resources: {{ include "common.resources" . | nindent 12 }}
56         env:
57         - name: ACTUATOR_USERNAME
58           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "login") | indent 10 }}
59         envFrom:
60         - configMapRef:
61             name: {{ include "common.fullname" . }}-configmap
62         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
63         ports: {{- include "common.containerPorts" . | nindent 10 }}
64         volumeMounts: {{ include "so.certificate.volume-mounts" . | nindent 8 }}
65         - name: logs
66           mountPath: /app/logs
67         - name: encoder
68           mountPath: /tmp/app
69         - name: config
70           mountPath: /app/config
71           readOnly: true
72 {{ include "helpers.livenessProbe" .| indent 8 }}
73       volumes: {{ include "so.certificate.volumes" . | nindent 6 }}
74       - name: logs
75         emptyDir: {}
76       - name: encoder
77         emptyDir:
78           medium: Memory
79       - name: config
80         configMap:
81             name: {{ include "common.fullname" . }}-app-configmap
82       imagePullSecrets:
83         - name: "{{ include "common.namespace" . }}-docker-registry-key"