[SO] Add helm chart for SO-ETSI-NFVO-NS-LCM
[oom.git] / kubernetes / so / charts / so-etsi-nfvo-ns-lcm / templates / deployment.yaml
1 # Copyright © 2020 Nordix Foundation
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: {{- include "common.templateMetadata" . | nindent 6 }}
29     spec:
30       initContainers: {{ include "so.certificate.container_importer" . | nindent 8 }}
31       containers:
32         - name: {{ include "common.name" . }}
33           command:
34             - sh
35           args:
36             - -c
37             - export ETSI_NFVO_PASSWORD=`htpasswd -bnBC 10 "" $ETSI_NFVO_PASSWORD_INPUT | tr -d ':\n' | sed 's/\$2y/\$2a/'`; ./start-app.sh
38           image: {{ include "common.repository" . }}/{{ .Values.image }}
39           resources: {{ include "common.resources" . | nindent 12 }}
40           env:
41             - name: TRUSTSTORE
42               value: {{ .Values.global.client.certs.truststore }}
43             - name: TRUSTSTORE_PASSWORD
44               valueFrom:
45                 secretKeyRef:
46                   name: {{ .Release.Name}}-so-client-certs-secret
47                   key: trustStorePassword
48             {{- if eq .Values.global.security.aaf.enabled true }}
49             - name: KEYSTORE
50               value: {{ .Values.global.client.certs.keystore }}
51             - name: KEYSTORE_PASSWORD
52               valueFrom:
53                 secretKeyRef:
54                   name: {{ .Release.Name}}-so-client-certs-secret
55                   key: keyStorePassword
56             {{- end }}
57             - name: ETSI_NFVO_USERNAME
58               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "etsi-nfvo-nslcm-creds" "key" "login") | indent 14 }}
59             - name: ETSI_NFVO_PASSWORD_INPUT
60               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "etsi-nfvo-nslcm-creds" "key" "password") | indent 14 }}
61           envFrom:
62             - configMapRef:
63                 name: {{ include "common.fullname" . }}-configmap
64           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65           volumeMounts: {{ include "so.certificate.volume-mounts" . | nindent 12 }}
66             - name: logs
67               mountPath: /app/logs
68             - name: config
69               mountPath: /app/config
70               readOnly: true
71             - name: {{ include "common.fullname" . }}-truststore
72               mountPath: /app/client
73               readonly: true
74           livenessProbe:
75             tcpSocket:
76               port: {{ index .Values.livenessProbe.port }}
77             initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
78             periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
79             successThreshold: {{ index .Values.livenessProbe.successThreshold}}
80             failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
81           ports: {{ include "common.containerPorts" . | nindent 12  }}
82       volumes: {{ include "so.certificate.volumes" . | nindent 8 }}
83         - name: logs
84           emptyDir: {}
85         - name: config
86           configMap:
87             name: {{ include "common.fullname" . }}-app-configmap
88         - name: {{ include "common.fullname" . }}-truststore
89           secret:
90             secretName: {{ include "common.release" . }}-so-truststore-secret
91       imagePullSecrets:
92         - name: "{{ include "common.namespace" . }}-docker-registry-key"