Mounting logback.xml file to champ MS
[oom.git] / kubernetes / policy / charts / pdp / templates / statefulset.yaml
1 # Copyright © 2017 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: apps/v1beta1
16 kind: StatefulSet
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: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   serviceName: {{ include "common.servicename" . }}
27   replicas: {{ .Values.replicaCount }}
28   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ .Release.Name }}
36     spec:
37       initContainers:
38       - command:
39         - /root/ready.py
40         args:
41         - --container-name
42         - {{ .Values.global.pap.nameOverride }}
43         env:
44         - name: NAMESPACE
45           valueFrom:
46             fieldRef:
47               apiVersion: v1
48               fieldPath: metadata.namespace
49         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51         name: {{ include "common.name" . }}-readiness
52       containers:
53       - command:
54         - /bin/bash
55         - ./do-start.sh
56         - pdp
57         name: {{ include "common.name" . }}
58         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         ports:
61         - containerPort: {{ .Values.service.externalPort }}
62         {{- if eq .Values.liveness.enabled true }}
63         livenessProbe:
64           tcpSocket:
65             port: {{ .Values.service.externalPort }}
66           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
67           periodSeconds: {{ .Values.liveness.periodSeconds }}
68         {{- end }}
69         readinessProbe:
70           tcpSocket:
71             port: {{ .Values.service.externalPort }}
72           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
73           periodSeconds: {{ .Values.readiness.periodSeconds }}
74         volumeMounts:
75         - mountPath: /etc/localtime
76           name: localtime
77           readOnly: true
78         - mountPath: /tmp/policy-install/config/base.conf
79           name: pe
80           subPath: base.conf
81         - mountPath: /tmp/policy-install/config/pdp-tweaks.sh
82           name: pe-pdp
83           subPath: pdp-tweaks.sh
84         - mountPath: /tmp/policy-install/config/pdplp.conf
85           name: pe-pdp
86           subPath: pdplp.conf
87         - mountPath: /tmp/policy-install/config/pdp.conf
88           name: pe-pdp
89           subPath: pdp.conf
90         - mountPath: /tmp/policy-install/do-start.sh
91           name: pe-scripts
92           subPath: do-start.sh
93         - mountPath: /var/log/onap
94           name: policy-logs
95         - mountPath:  /tmp/logback.xml
96           name: policy-logback
97           subPath: logback.xml
98         lifecycle:
99           postStart:
100             exec:
101               command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/servers/pdp/webapps/pdp/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
102       - image: {{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}
103         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
104         name: filebeat-onap
105         volumeMounts:
106         - mountPath: /usr/share/filebeat/filebeat.yml
107           name: filebeat-conf
108           subPath: filebeat.yml
109         - mountPath: /var/log/onap
110           name: policy-logs
111         - mountPath: /usr/share/filebeat/data
112           name: policy-data-filebeat
113         resources:
114 {{ toYaml .Values.resources | indent 12 }}
115       {{- if .Values.nodeSelector }}
116       nodeSelector:
117 {{ toYaml .Values.nodeSelector | indent 10 }}
118       {{- end -}}
119       {{- if .Values.affinity }}
120       affinity:
121 {{ toYaml .Values.affinity | indent 10 }}
122         {{- end }}
123       volumes:
124       - name: localtime
125         hostPath:
126           path: /etc/localtime
127       - name: filebeat-conf
128         configMap:
129           name: {{ .Release.Name }}-filebeat-configmap
130       - name: policy-logs
131         emptyDir: {}
132       - name: policy-data-filebeat
133         emptyDir: {}
134       - name: policy-logback
135         configMap:
136           name: {{ include "common.fullname" . }}-log-configmap
137       - name: pe
138         configMap:
139           name: {{ .Release.Name }}-pe-configmap
140           defaultMode: 0755
141       - name: pe-scripts
142         configMap:
143           name: {{ .Release.Name }}-pe-scripts-configmap
144           defaultMode: 0777
145       - name: pe-pdp
146         configMap:
147           name: {{ include "common.fullname" . }}-pe-configmap
148           defaultMode: 0755
149       imagePullSecrets:
150       - name: "{{ include "common.namespace" . }}-docker-registry-key"