Add K8S deployment above Vagrant
[sdc.git] / sdc-os-chef / kubernetes / sdc / templates / deployments / sdc-be.yaml
1 #{{ if not .Values.disableSdcSdcBe }}
2 apiVersion: extensions/v1beta1
3 kind: Deployment
4 metadata:
5   labels:
6     app: sdc-be
7   name: sdc-be
8   namespace: "{{ .Values.nsPrefix }}-sdc"
9 spec:
10   replicas: 1
11   strategy:
12     type: RollingUpdate
13     rollingUpdate:
14       maxSurge: 2
15       maxUnavailable: 0
16   selector:
17     matchLabels:
18       app: sdc-be
19   template:
20     metadata:
21       annotations:
22         checksum/config: {{ include (print $.Template.BasePath "/configmaps/sdc-environment-configmap.yaml") . | sha256sum }}
23         checksum/config: {{ include (print $.Template.BasePath "/configmaps/sdc-check-job-completion.yaml") . | sha256sum }}
24       labels:
25         app: sdc-be
26       name: sdc-be
27     spec:
28       initContainers:
29       - name: sdc-be-readiness
30         image: {{ .Values.image.readiness }}
31         imagePullPolicy: {{ .Values.pullPolicy }}
32         command:
33         - /root/ready.py
34         args:
35         - --container-name
36         - sdc-es
37         - --container-name
38         - sdc-cs
39         - --container-name
40         - sdc-kb
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47       - name: sdc-job-completion
48         image: {{ .Values.image.readiness }}
49         imagePullPolicy: {{ .Values.pullPolicy }}
50         command:
51         - python
52         args:
53         - /root/readiness/sdc_check_job_completion.py
54         - --job-name
55         - sdc-config-cassandra
56         env:
57         - name: NAMESPACE
58           valueFrom:
59             fieldRef:
60               apiVersion: v1
61               fieldPath: metadata.namespace
62         volumeMounts:
63         - mountPath: /root/readiness
64           name: sdc-check-job-completion
65       containers:
66       - name: sdc-be
67         image: {{ .Values.image.sdcBackend }}
68         imagePullPolicy: {{ .Values.pullPolicy }}
69         ports:
70         - containerPort: 8443
71         - containerPort: 8080
72         volumeMounts:
73         - mountPath: /usr/share/elasticsearch/data/
74           name: sdc-sdc-es-es
75         - mountPath: /root/chef-solo/environments/
76           name: sdc-environments
77         - mountPath: /etc/localtime
78           name: sdc-localtime
79           readOnly: true
80         - mountPath: /var/lib/jetty/logs
81           name: sdc-logs
82         - mountPath: /var/log/onap
83           name: sdc-logs-2
84         - mountPath: /tmp/logback.xml
85           name: sdc-logback
86         env:
87         - name: ENVNAME
88           value: AUTO
89         - name: HOST_IP
90           valueFrom:
91             fieldRef:
92               fieldPath: status.podIP
93         lifecycle:
94           postStart:
95             exec:
96               command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/catalog-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
97         readinessProbe:
98           tcpSocket:
99             port: 8443
100           initialDelaySeconds: 5
101           periodSeconds: 10
102       volumes:
103         - name: filebeat-conf
104           hostPath:
105             path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/filebeat/logback/filebeat.yml
106         - name: sdc-logs-2
107           emptyDir: {}
108         - name: sdc-data-filebeat
109           emptyDir: {}
110         - name: sdc-logback
111           hostPath:
112             path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/sdc/be/logback.xml
113         - name: sdc-sdc-es-es
114           hostPath:
115             path: /dockerdata-nfs/{{ .Values.nsPrefix }}/sdc/sdc-es/ES
116         - name: sdc-environments
117           configMap:
118             name: sdc-environment
119         - name: sdc-localtime
120           hostPath:
121             path:  /etc/localtime
122         - name:  sdc-logs
123           hostPath:
124             path:  /dockerdata-nfs/{{ .Values.nsPrefix }}/sdc/logs
125         - name: sdc-check-job-completion
126           configMap:
127             name: sdc-check-job-completion
128       imagePullSecrets:
129       - name: "{{ .Values.nsPrefix }}-docker-registry-key"
130 #{{ end }}