Mounting logback.xml file to champ MS
[oom.git] / kubernetes / policy / charts / drools / 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.mariadb.nameOverride }}
43         - --container-name
44         - {{ .Values.global.nexus.nameOverride }}
45         env:
46         - name: NAMESPACE
47           valueFrom:
48             fieldRef:
49               apiVersion: v1
50               fieldPath: metadata.namespace
51         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
52         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53         name: {{ include "common.name" . }}-readiness
54       containers:
55         - name: {{ include "common.name" . }}
56           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
57           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58           ports:
59           - containerPort: {{ .Values.service.externalPort }}
60           - containerPort: {{ .Values.service.externalPort2 }}
61           command:
62           - /bin/bash
63           - -c
64           - ./do-start.sh
65           {{- if eq .Values.liveness.enabled true }}
66           livenessProbe:
67             tcpSocket:
68               port: {{ .Values.service.externalPort }}
69             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
70             periodSeconds: {{ .Values.liveness.periodSeconds }}
71           {{- end }}
72           readinessProbe:
73             tcpSocket:
74               port: {{ .Values.service.externalPort }}
75             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
76             periodSeconds: {{ .Values.readiness.periodSeconds }}
77           env:
78           - name: REPLICAS
79             value: "{{ .Values.replicaCount }}"
80           volumeMounts:
81           - mountPath: /etc/localtime
82             name: localtime
83             readOnly: true
84           - mountPath: /tmp/policy-install/config/feature-healthcheck.conf
85             name: drools-secret
86             subPath: feature-healthcheck.conf
87           - mountPath: /tmp/policy-install/config/feature-pooling-dmaap.conf
88             name: drools-config
89             subPath: feature-pooling-dmaap.conf
90           - mountPath: /tmp/policy-install/config/base.conf
91             name: drools-config
92             subPath: base.conf
93           - mountPath: /tmp/policy-install/config/policy-management.conf
94             name: drools-config
95             subPath: policy-management.conf
96           - mountPath: /tmp/policy-install/config/drools-tweaks.sh
97             name: drools-config
98             subPath: drools-tweaks.sh
99           - mountPath: /tmp/policy-install/config/apps-install.sh
100             name: drools-config
101             subPath: apps-install.sh
102           - mountPath: /tmp/policy-install/config/drools-preinstall.sh
103             name: drools-config
104             subPath: drools-preinstall.sh
105           - mountPath: /usr/share/maven/conf/settings.xml
106             name: drools-settingsxml
107             subPath: settings.xml
108           - mountPath: /var/log/onap
109             name: policy-logs
110           - mountPath: /tmp/logback.xml
111             name: policy-logback
112             subPath: logback.xml
113           lifecycle:
114             postStart:
115               exec:
116                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/config/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
117           resources:
118 {{ toYaml .Values.resources | indent 12 }}
119         {{- if .Values.nodeSelector }}
120         - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.loggingImage }}"
121           imagePullPolicy: {{ .Values.pullPolicy }}
122           name: filebeat-onap
123           volumeMounts:
124           - mountPath: /usr/share/filebeat/filebeat.yml
125             name: filebeat-conf
126             subPath: filebeat.yml
127           - mountPath: /var/log/onap
128             name: policy-logs
129           - mountPath: /usr/share/filebeat/data
130             name: policy-data-filebeat
131         nodeSelector:
132 {{ toYaml .Values.nodeSelector | indent 10 }}
133         {{- end -}}
134         {{- if .Values.affinity }}
135         affinity:
136 {{ toYaml .Values.affinity | indent 10 }}
137         {{- end }}
138       volumes:
139         - name: localtime
140           hostPath:
141             path: /etc/localtime
142         - name: filebeat-conf
143           configMap:
144             name: {{ .Release.Name }}-filebeat-configmap
145         - name: policy-logs
146           emptyDir: {}
147         - name: policy-data-filebeat
148           emptyDir: {}
149         - name: policy-logback
150           configMap:
151             name: {{ include "common.fullname" . }}-log-configmap
152         - name: drools-settingsxml
153           configMap:
154             name: {{ include "common.fullname" . }}-settings-configmap
155         - name: drools-config
156           configMap:
157             name: {{ include "common.fullname" . }}-configmap
158             items:
159             - key: base.conf
160               path: base.conf
161               mode: 0755
162             - key: feature-pooling-dmaap.conf
163               path: feature-pooling-dmaap.conf
164               mode: 0755
165             - key: policy-management.conf
166               path: policy-management.conf
167               mode: 0755
168             - key: drools-tweaks.sh
169               path: drools-tweaks.sh
170               mode: 0755
171             - key: apps-install.sh
172               path: apps-install.sh
173               mode: 0755
174             - key: drools-preinstall.sh
175               path: drools-preinstall.sh
176               mode: 0755
177         - name: drools-secret
178           secret:
179             secretName: {{ include "common.fullname" . }}-secret
180             items:
181             - key: feature-healthcheck.conf
182               path: feature-healthcheck.conf
183               mode: 0644
184       imagePullSecrets:
185       - name: "{{ include "common.namespace" . }}-docker-registry-key"