[CONSUL] Add limits to consul chart.
[oom.git] / kubernetes / so / components / so-nssmf-adapter / templates / deployment.yaml
1 # Copyright © 2020 Huawei Technologies Co., Ltd.
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 apiVersion: apps/v1
15 kind: Deployment
16 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
17 spec:
18   selector: {{- include "common.selectors" . | nindent 4 }}
19   replicas: {{ index .Values.replicaCount }}
20   minReadySeconds: {{ index .Values.minReadySeconds }}
21   strategy:
22     type: {{ index .Values.updateStrategy.type }}
23     rollingUpdate:
24       maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
25       maxSurge: {{ index .Values.updateStrategy.maxSurge }}
26   template:
27     metadata:
28       labels: {{- include "common.labels" . | nindent 8 }}
29     spec:
30       initContainers: {{ include "so.certificate.container_importer" . | nindent 8 }}
31         - name: {{ include "common.name" . }}-readiness
32           command:
33             - /app/ready.py
34           args:
35             - --job-name
36             - {{ include "common.release" . }}-so-mariadb-config-job
37           env:
38             - name: NAMESPACE
39               valueFrom:
40                 fieldRef:
41                   apiVersion: v1
42                   fieldPath: metadata.namespace
43           image: {{ include "common.repository" . }}/{{ .Values.global.readinessImage }}
44           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45       containers:
46         - name: {{ include "common.name" . }}
47           command:
48             - sh
49           args:
50             - -c
51             - |
52               export BPEL_PASSWORD=`htpasswd -bnBC 10 "" $BPEL_PASSWORD_INPUT | tr -d ':\n' | sed 's/\$2y/\$2a/'`
53               export ACTUATOR_PASSWORD=`htpasswd -bnBC 10 "" $ACTUATOR_PASSWORD_INPUT | tr -d ':\n' | sed 's/\$2y/\$2a/'`
54               {{- if .Values.global.aafEnabled }}
55               export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0)
56               export TRUSTSTORE_PASSWORD="${cadi_truststore_password}"
57               {{- if .Values.global.security.aaf.enabled }}
58               export KEYSTORE_PASSWORD="${cadi_keystore_password}"
59               {{- end }}
60               {{- end }}
61               ./start-app.sh
62           image: {{ include "common.repository" . }}/{{ .Values.image }}
63           resources: {{ include "common.resources" . | nindent 12 }}
64           ports: {{- include "common.containerPorts" . | nindent 12  }}
65           env:
66             - name: DB_HOST
67               valueFrom:
68                 secretKeyRef:
69                   name: {{ include "common.release" . }}-so-db-secrets
70                   key: mariadb.readwrite.host
71             - name: DB_PORT
72               valueFrom:
73                 secretKeyRef:
74                   name: {{ include "common.release" . }}-so-db-secrets
75                   key: mariadb.readwrite.port
76             - name: DB_USERNAME
77               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 14 }}
78             - name: DB_PASSWORD
79               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 14 }}
80             - name: DB_ADMIN_USERNAME
81               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 14 }}
82             - name: DB_ADMIN_PASSWORD
83               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 14 }}
84             - name: BPEL_USERNAME
85               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-bpel-creds" "key" "login") | indent 14 }}
86             - name: BPEL_PASSWORD_INPUT
87               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-bpel-creds" "key" "password") | indent 14 }}
88             - name: ACTUATOR_USERNAME
89               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "login") | indent 14 }}
90             - name: ACTUATOR_PASSWORD_INPUT
91               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "server-actuator-creds" "key" "password") | indent 14 }}
92             {{ include "so.certificates.env" . | nindent 12 }}
93           envFrom:
94             - configMapRef:
95                 name: {{ include "common.fullname" . }}-env
96           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
97           volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 12 }}
98             - name: logs
99               mountPath: /app/logs
100             - name: config
101               mountPath: /app/config
102               readOnly: true
103             - name: {{ include "common.fullname" . }}-truststore
104               mountPath: /app/client
105               readOnly: true
106           livenessProbe:
107             httpGet:
108               path: {{ index .Values.livenessProbe.path}}
109               port: {{ index .Values.containerPort }}
110               scheme: {{ index .Values.livenessProbe.scheme}}
111             initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
112             periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
113             timeoutSeconds: {{ index .Values.livenessProbe.timeoutSeconds}}
114             successThreshold: {{ index .Values.livenessProbe.successThreshold}}
115             failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
116       volumes: {{ include "so.certificate.volumes" . | nindent 8 }}
117         - name: logs
118           emptyDir: {}
119         - name: config
120           configMap:
121             name: {{ include "common.fullname" . }}
122         - name:  {{ include "common.fullname" . }}-truststore
123           secret:
124             secretName: {{ include "common.release" . }}-so-truststore-secret
125       imagePullSecrets:
126         - name: "{{ include "common.namespace" . }}-docker-registry-key"