18aefb36c663ab8a03095f8559843c8339130cb5
[oom.git] / kubernetes / cds / components / cds-py-executor / templates / deployment.yaml
1 {{/*
2 # Copyright (c) 2020 Bell Canada, Deutsche Telekom
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   replicas: {{ .Values.replicaCount }}
22   selector: {{- include "common.selectors" . | nindent 4 }}
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       containers:
27         - name: {{ include "common.name" . }}
28           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
29           command:
30             - bash
31           args:
32             - '-c'
33             - 'AUTH_TOKEN=`echo -n $API_USERNAME:$API_PASSWORD | base64` /opt/app/onap/python/start.sh'
34           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
35           ports: {{- include "common.containerPorts" . | nindent 12 }}
36           {{ if .Values.liveness.enabled }}
37           livenessProbe:
38             tcpSocket:
39               port: {{ .Values.liveness.port }}
40             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
41             periodSeconds: {{ .Values.liveness.periodSeconds }}
42             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
43           {{ end }}
44           readinessProbe:
45             tcpSocket:
46               port: {{ .Values.liveness.port }}
47             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
48             periodSeconds: {{ .Values.readiness.periodSeconds }}
49             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
50           env:
51           - name: APP_PORT
52             value: {{ .Values.config.appPort }}
53           - name: AUTH_TYPE
54             value: {{ .Values.config.authType }}
55           - name: API_USERNAME
56             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-credentials" "key" "login") | nindent 12 }}
57           - name: API_PASSWORD
58             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-credentials" "key" "password") | nindent 12 }}
59           - name: LOG_FILE
60             value: {{ .Values.config.logFile }}
61           - name: ARTIFACT_MANAGER_PORT
62             value: {{ .Values.config.artifactManagerPort }}
63           - name: ARTIFACT_MANAGER_SERVER_LOG_FILE
64             value: {{ .Values.config.artifactManagerLogFile }}
65           volumeMounts:
66           - mountPath: /etc/localtime
67             name: localtime
68             readOnly: true
69           - mountPath: {{ .Values.persistence.deployedBlueprint }}
70             name: {{ include "common.fullname" . }}-blueprints
71           resources:
72 {{ include "common.resources" . | nindent 12 }}
73         {{- if .Values.nodeSelector }}
74         nodeSelector:
75 {{ toYaml .Values.nodeSelector | nindent 10 }}
76         {{- end -}}
77         {{- if .Values.affinity }}
78         affinity:
79 {{ toYaml .Values.affinity | nindent 10 }}
80         {{- end }}
81       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
82       volumes:
83         - name: localtime
84           hostPath:
85             path: /etc/localtime
86         # Py executor shares the blueprintsprocessor storage (for now) to
87         # share uploaded CBA files. In the future it will be deprecated
88         # when all parts of the CDS will make use of Artifact Manager
89         - name: {{ include "common.fullname" . }}-blueprints
90           persistentVolumeClaim:
91             claimName: {{ include "common.release" . }}-cds-blueprints
92       {{- include "common.imagePullSecrets" . | nindent 6 }}