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