Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / sdnc / components / sdnc-ansible-server / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
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       initContainers:
27       - command:
28         - sh
29         args:
30         - -c
31         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
32         env:
33         - name: DB_USER
34           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
35         - name: DB_PASSWORD
36           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
37         - name: REST_USER
38           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "rest-creds" "key" "login") | indent 10 }}
39         - name: REST_PASSWORD
40           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "rest-creds" "key" "password") | indent 10 }}
41         volumeMounts:
42         - mountPath: /config-input
43           name: config-input
44         - mountPath: /config
45           name: config
46         image: {{ include "repositoryGenerator.image.envsubst" . }}
47         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48         name: {{ include "common.name" . }}-update-config
49
50       - command:
51         - /app/ready.py
52         args:
53         - --service-name
54         - {{ .Values.config.sdncChartName }}
55         env:
56         - name: NAMESPACE
57           valueFrom:
58             fieldRef:
59               apiVersion: v1
60               fieldPath: metadata.namespace
61         image: {{ include "repositoryGenerator.image.readiness" . }}
62         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
63         name: {{ include "common.name" . }}-readiness
64         resources:
65           limits:
66             cpu: "100m"
67             memory: "500Mi"
68           requests:
69             cpu: "3m"
70             memory: "20Mi"
71       containers:
72         - name: {{ include "common.name" . }}
73           command: ["/bin/bash"]
74           args: ["-c", "cd /opt/ansible-server && ./startAnsibleServer.sh"]
75
76           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
77           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78           ports: {{ include "common.containerPorts" . | nindent 12  }}
79           # disable liveness probe when breakpoints set in debugger
80           # so K8s doesn't restart unresponsive container
81           {{ if .Values.liveness.enabled }}
82           livenessProbe:
83             tcpSocket:
84               port: {{ .Values.service.internalPort }}
85             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86             periodSeconds: {{ .Values.liveness.periodSeconds }}
87           {{ end }}
88           readinessProbe:
89             tcpSocket:
90               port: {{ .Values.service.internalPort }}
91             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
92             periodSeconds: {{ .Values.readiness.periodSeconds }}
93           volumeMounts:
94           - mountPath: {{ .Values.config.configDir }}/RestServer_config
95             name: config
96             subPath: RestServer_config
97           resources: {{ include "common.resources" . | nindent 12 }}
98       {{- if .Values.nodeSelector }}
99       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
100       {{- end }}
101       {{- if .Values.affinity }}
102       affinity: {{ toYaml .Values.affinity | nindent 8 }}
103       {{- end }}
104       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
105       volumes:
106         - name: config-input
107           configMap:
108             name: {{ include "common.fullname" . }}
109             defaultMode: 0644
110         - name: config
111           emptyDir:
112             medium: Memory
113       {{- include "common.imagePullSecrets" . | nindent 6 }}