Merge "License Addition for Dcaegen2,Policy,Dmaap"
[oom.git] / kubernetes / policy / charts / pdp / templates / statefulset.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: apps/v1beta1
17 kind: StatefulSet
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   serviceName: {{ include "common.servicename" . }}
28   replicas: {{ .Values.replicaCount }}
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ .Release.Name }}
37     spec:
38       initContainers:
39       - command:
40         - /root/ready.py
41         args:
42         - --container-name
43         - {{ .Values.global.pap.nameOverride }}
44         env:
45         - name: NAMESPACE
46           valueFrom:
47             fieldRef:
48               apiVersion: v1
49               fieldPath: metadata.namespace
50         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         name: {{ include "common.name" . }}-readiness
53       containers:
54       - command:
55         - /bin/bash
56         - ./do-start.sh
57         - pdp
58         name: {{ include "common.name" . }}
59         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
60         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61         ports:
62         - containerPort: {{ .Values.service.externalPort }}
63         {{- if eq .Values.liveness.enabled true }}
64         livenessProbe:
65           tcpSocket:
66             port: {{ .Values.service.externalPort }}
67           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
68           periodSeconds: {{ .Values.liveness.periodSeconds }}
69         {{- end }}
70         readinessProbe:
71           tcpSocket:
72             port: {{ .Values.service.externalPort }}
73           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
74           periodSeconds: {{ .Values.readiness.periodSeconds }}
75         volumeMounts:
76         - mountPath: /etc/localtime
77           name: localtime
78           readOnly: true
79         - mountPath: /tmp/policy-install/config/base.conf
80           name: pe
81           subPath: base.conf
82         - mountPath: /tmp/policy-install/config/pdp-tweaks.sh
83           name: pe-pdp
84           subPath: pdp-tweaks.sh
85         - mountPath: /tmp/policy-install/config/pdplp.conf
86           name: pe-pdp
87           subPath: pdplp.conf
88         - mountPath: /tmp/policy-install/config/pdp.conf
89           name: pe-pdp
90           subPath: pdp.conf
91         - mountPath: /tmp/policy-install/do-start.sh
92           name: pe-scripts
93           subPath: do-start.sh
94         - mountPath: /var/log/onap
95           name: policy-logs
96         - mountPath:  /tmp/logback.xml
97           name: policy-logback
98           subPath: logback.xml
99         lifecycle:
100           postStart:
101             exec:
102               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"]
103       - image: {{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}
104         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
105         name: filebeat-onap
106         volumeMounts:
107         - mountPath: /usr/share/filebeat/filebeat.yml
108           name: filebeat-conf
109           subPath: filebeat.yml
110         - mountPath: /var/log/onap
111           name: policy-logs
112         - mountPath: /usr/share/filebeat/data
113           name: policy-data-filebeat
114         resources:
115 {{ toYaml .Values.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: filebeat-conf
129         configMap:
130           name: {{ .Release.Name }}-filebeat-configmap
131       - name: policy-logs
132         emptyDir: {}
133       - name: policy-data-filebeat
134         emptyDir: {}
135       - name: policy-logback
136         configMap:
137           name: {{ include "common.fullname" . }}-log-configmap
138       - name: pe
139         configMap:
140           name: {{ .Release.Name }}-pe-configmap
141           defaultMode: 0755
142       - name: pe-scripts
143         configMap:
144           name: {{ .Release.Name }}-pe-scripts-configmap
145           defaultMode: 0777
146       - name: pe-pdp
147         configMap:
148           name: {{ include "common.fullname" . }}-pe-configmap
149           defaultMode: 0755
150       imagePullSecrets:
151       - name: "{{ include "common.namespace" . }}-docker-registry-key"