[COMMON] new logConfiguration chart
[oom.git] / kubernetes / sdnc / charts / 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: extensions/v1beta1
18 kind: Deployment
19 metadata:
20   name: {{ include "common.fullname" . }}
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34     spec:
35       initContainers:
36       - command:
37         - sh
38         args:
39         - -c
40         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
41         env:
42         - name: DB_USER
43           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
44         - name: DB_PASSWORD
45           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
46         - name: REST_USER
47           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "rest-creds" "key" "login") | indent 10 }}
48         - name: REST_PASSWORD
49           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "rest-creds" "key" "password") | indent 10 }}
50         volumeMounts:
51         - mountPath: /config-input
52           name: config-input
53         - mountPath: /config
54           name: config
55         image: "{{ .Values.global.envsubstImage }}"
56         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57         name: {{ include "common.name" . }}-update-config
58
59       - command:
60         - /root/ready.py
61         args:
62         - --container-name
63         - {{ .Values.config.sdncChartName }}
64         env:
65         - name: NAMESPACE
66           valueFrom:
67             fieldRef:
68               apiVersion: v1
69               fieldPath: metadata.namespace
70         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
71         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72         name: {{ include "common.name" . }}-readiness
73       containers:
74         - name: {{ include "common.name" . }}
75           command: ["/bin/bash"]
76           args: ["-c", "cd /opt/onap/ccsdk && ./startAnsibleServer.sh"]
77
78           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
79           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
80           ports:
81           - containerPort: {{ .Values.service.internalPort }}
82           # disable liveness probe when breakpoints set in debugger
83           # so K8s doesn't restart unresponsive container
84           {{ if .Values.liveness.enabled }}
85           livenessProbe:
86             tcpSocket:
87               port: {{ .Values.service.internalPort }}
88             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
89             periodSeconds: {{ .Values.liveness.periodSeconds }}
90           {{ end }}
91           readinessProbe:
92             tcpSocket:
93               port: {{ .Values.service.internalPort }}
94             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
95             periodSeconds: {{ .Values.readiness.periodSeconds }}
96           volumeMounts:
97           - mountPath: /etc/localtime
98             name: localtime
99             readOnly: true
100           - mountPath: {{ .Values.config.configDir }}/RestServer_config
101             name: config
102             subPath: RestServer_config
103           resources:
104 {{ include "common.resources" . | indent 12 }}
105         {{- if .Values.nodeSelector }}
106         nodeSelector:
107 {{ toYaml .Values.nodeSelector | indent 10 }}
108         {{- end -}}
109         {{- if .Values.affinity }}
110         affinity:
111 {{ toYaml .Values.affinity | indent 10 }}
112         {{- end }}
113       volumes:
114         - name: localtime
115           hostPath:
116             path: /etc/localtime
117         - name: config-input
118           configMap:
119             name: {{ include "common.fullname" . }}
120             defaultMode: 0644
121         - name: config
122           emptyDir:
123             medium: Memory
124       imagePullSecrets:
125       - name: "{{ include "common.namespace" . }}-docker-registry-key"