Updating README with monior changes
[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.fullname" . }}
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       hostAliases:
55       - ip: "{{ .Values.config.aaiServiceClusterIp }}"
56         hostnames:
57         - "aai.api.simpledemo.openecomp.org"
58       containers:
59         - name: {{ include "common.name" . }}
60           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
61           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62           ports:
63           - containerPort: {{ .Values.service.externalPort }}
64           - containerPort: {{ .Values.service.externalPort2 }}
65           command:
66           - /bin/bash
67           - -c
68           - ./do-start.sh
69           {{- if eq .Values.liveness.enabled true }}
70           livenessProbe:
71             tcpSocket:
72               port: {{ .Values.service.externalPort }}
73             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
74             periodSeconds: {{ .Values.liveness.periodSeconds }}
75           {{- end }}
76           readinessProbe:
77             tcpSocket:
78               port: {{ .Values.service.externalPort }}
79             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
80             periodSeconds: {{ .Values.readiness.periodSeconds }}
81           env:
82           - name: REPLICAS
83             value: "{{ .Values.replicaCount }}"
84           volumeMounts:
85           - mountPath: /etc/localtime
86             name: localtime
87             readOnly: true
88           - mountPath: /tmp/policy-install/config/policy-keystore
89             name: drools-secret
90             subPath: policy-keystore
91           - mountPath: /tmp/policy-install/config/feature-healthcheck.conf
92             name: drools-secret
93             subPath: feature-healthcheck.conf
94           - mountPath: /tmp/policy-install/config/base.conf
95             name: drools-config
96             subPath: base.conf
97           - mountPath: /tmp/policy-install/config/policy-management.conf
98             name: drools-config
99             subPath: policy-management.conf
100           - mountPath: /tmp/policy-install/config/drools-tweaks.sh
101             name: drools-config
102             subPath: drools-tweaks.sh
103           - mountPath: /usr/share/maven/conf/settings.xml
104             name: drools-settingsxml
105             subPath: settings.xml
106           - mountPath: /var/log/onap
107             name: policy-logs
108           - mountPath: /tmp/logback.xml
109             name: policy-logback
110             subPath: logback.xml
111           - mountPath: /tmp/policy-install/do-start.sh
112             name: pe-scripts
113             subPath: do-start.sh
114           lifecycle:
115             postStart:
116               exec:
117                 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"]
118           resources:
119 {{ toYaml .Values.resources | indent 12 }}
120         {{- if .Values.nodeSelector }}
121         - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.loggingImage }}"
122           imagePullPolicy: {{ .Values.pullPolicy }}
123           name: filebeat-onap
124           volumeMounts:
125           - mountPath: /usr/share/filebeat/filebeat.yml
126             name: filebeat-conf
127             subPath: filebeat.yml
128           - mountPath: /var/log/onap
129             name: policy-logs
130           - mountPath: /usr/share/filebeat/data
131             name: policy-data-filebeat
132         nodeSelector:
133 {{ toYaml .Values.nodeSelector | indent 10 }}
134         {{- end -}}
135         {{- if .Values.affinity }}
136         affinity:
137 {{ toYaml .Values.affinity | indent 10 }}
138         {{- end }}
139       volumes:
140         - name: localtime
141           hostPath:
142             path: /etc/localtime
143         - name: filebeat-conf
144           configMap:
145             name: {{ .Release.Name }}-filebeat-configmap
146         - name: policy-logs
147           emptyDir: {}
148         - name: policy-data-filebeat
149           emptyDir: {}
150         - name: policy-logback
151           configMap:
152             name: {{ include "common.fullname" . }}-log-configmap
153         - name: drools-settingsxml
154           configMap:
155             name: {{ include "common.fullname" . }}-settings-configmap
156         - name: drools-config
157           configMap:
158             name: {{ include "common.fullname" . }}-configmap
159             items:
160             - key: base.conf
161               path: base.conf
162               mode: 0755
163             - key: policy-management.conf
164               path: policy-management.conf
165               mode: 0755
166             - key: drools-tweaks.sh
167               path: drools-tweaks.sh
168               mode: 0755
169         - name: drools-secret
170           secret:
171             secretName: {{ include "common.fullname" . }}-secret
172             items:
173             - key: policy-keystore
174               path: policy-keystore
175               mode: 0644
176             - key: feature-healthcheck.conf
177               path: feature-healthcheck.conf
178               mode: 0644
179         - name: pe-scripts
180           configMap:
181             name: {{ include "common.fullname" . }}-script-configmap
182             defaultMode: 0777
183       imagePullSecrets:
184       - name: "{{ include "common.namespace" . }}-docker-registry-key"