Merge "Temporarily remove the dependency on Cassandra"
[oom.git] / kubernetes / common / dgbuilder / templates / deployment.yaml
1 # Copyright © 2018 AT&T, Amdocs, Bell Canada
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: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ include "common.release" . }}
32     spec:
33       initContainers:
34       - command:
35         - sh
36         args:
37         - -c
38         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
39         env:
40         - name: DB_USER
41           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
42         - name: DB_PASSWORD
43           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
44         - name: HTTP_USER
45           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "http-user-creds" "key" "login") | indent 10 }}
46         - name: HTTP_PASSWORD
47           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "http-user-creds" "key" "password") | indent 10 }}
48         - name: HTTP_ADMIN_USER
49           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "admin-creds" "key" "login") | indent 10 }}
50         - name: HTTP_ADMIN_PASSWORD
51           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "admin-creds" "key" "password") | indent 10 }}
52         - name: HTTP_NODE_USER
53           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "node-creds" "key" "login") | indent 10 }}
54         - name: HTTP_NODE_PASSWORD
55           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "node-creds" "key" "password") | indent 10 }}
56         - name: REST_CONF_USER
57           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
58         - name: REST_CONF_PASSWORD
59           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
60         volumeMounts:
61         - mountPath: /config-input
62           name: config-input
63         - mountPath: /config
64           name: config
65         image: "{{ .Values.global.envsubstImage }}"
66         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67         name: {{ include "common.name" . }}-update-config
68       - command:
69         - /root/ready.py
70         args:
71         - --container-name
72         - {{ .Values.config.dbPodName }}
73         env:
74         - name: NAMESPACE
75           valueFrom:
76             fieldRef:
77               apiVersion: v1
78               fieldPath: metadata.namespace
79         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
80         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
81         name: {{ include "common.name" . }}-readiness
82       containers:
83         - name: {{ include "common.name" . }}
84           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
85           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
86           command: ["/bin/bash"]
87           args: ["-c", "cd /opt/onap/ccsdk/dgbuilder/ && ./start.sh sdnc1.0 && wait"]
88           ports:
89           - containerPort: {{ .Values.service.internalPort }}
90           readinessProbe:
91             tcpSocket:
92               port: {{ .Values.service.internalPort }}
93             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
94             periodSeconds: {{ .Values.readiness.periodSeconds }}
95           env:
96           - name: SDNC_CONFIG_DIR
97             value: /opt/onap/sdnc/data/properties
98           volumeMounts:
99           - mountPath: /etc/localtime
100             name: localtime
101             readOnly: true
102           - name: config
103             mountPath: /opt/app/application.properties
104             subPath: application.properties
105           - name: config
106             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/conf/svclogic.properties
107             subPath: svclogic.properties
108           - name: config
109             mountPath: /opt/onap/ccsdk/dgbuilder/svclogic/svclogic.properties
110             subPath: svclogic.properties
111           - name: config
112             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/customSettings.js
113             subPath: customSettings.js
114           resources:
115 {{ include "common.resources" . | indent 12 }}
116         {{- if .Values.nodeSelector }}
117         nodeSelector:
118 {{ toYaml .Values.nodeSelector | indent 10 }}
119         {{- end -}}
120         {{- if .Values.affinity }}
121         affinity:
122 {{ toYaml .Values.affinity | indent 10 }}
123         {{- end }}
124       volumes:
125         - name: localtime
126           hostPath:
127             path: /etc/localtime
128         - name: config-input
129           configMap:
130             name: {{ include "common.fullname" . }}-config
131         - name: config
132           emptyDir:
133             medium: Memory
134       imagePullSecrets:
135       - name: "{{ include "common.namespace" . }}-docker-registry-key"