Merge "Fixed typo in quickstart guide"
[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.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.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: {{ .Values.global.repository | default .Values.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/
82           name: pe-pdp
83         - mountPath: /tmp/policy-install/do-start.sh
84           name: pe-scripts
85           subPath: do-start.sh
86         - mountPath: /var/log/onap
87           name: policy-logs
88         - mountPath:  /tmp/logback.xml
89           name: policy-logback
90           subPath: logback.xml
91         lifecycle:
92           postStart:
93             exec:
94               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"]
95       - image: {{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}
96         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
97         name: filebeat-onap
98         volumeMounts:
99         - mountPath: /usr/share/filebeat/filebeat.yml
100           name: filebeat-conf
101           subPath: filebeat.yml
102         - mountPath: /var/log/onap
103           name: policy-logs
104         - mountPath: /usr/share/filebeat/data
105           name: policy-data-filebeat
106         resources:
107 {{ toYaml .Values.resources | indent 12 }}
108       {{- if .Values.nodeSelector }}
109       nodeSelector:
110 {{ toYaml .Values.nodeSelector | indent 10 }}
111       {{- end -}}
112       {{- if .Values.affinity }}
113       affinity:
114 {{ toYaml .Values.affinity | indent 10 }}
115         {{- end }}
116       volumes:
117       - name: localtime
118         hostPath:
119           path: /etc/localtime
120       - name: filebeat-conf
121         configMap:
122           name: {{ .Release.Name }}-filebeat-configmap
123       - name: policy-logs
124         emptyDir: {}
125       - name: policy-data-filebeat
126         emptyDir: {}
127       - name: policy-logback
128         configMap:
129           name: {{ include "common.fullname" . }}-log-configmap
130       - name: pe
131         configMap:
132           name: {{ .Release.Name }}-pe-configmap
133           defaultMode: 0755
134       - name: pe-scripts
135         configMap:
136           name: {{ .Release.Name }}-pe-scripts-configmap
137           defaultMode: 0777
138       - name: pe-pdp
139         configMap:
140           name: {{ include "common.fullname" . }}-pe-configmap
141           defaultMode: 0755
142       imagePullSecrets:
143       - name: "{{ include "common.namespace" . }}-docker-registry-key"