[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / dmaap / components / dmaap-dr-node / 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 apiVersion: apps/v1
15 kind: StatefulSet
16 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
17 spec:
18   selector: {{- include "common.selectors" . | nindent 4 }}
19   serviceName: {{ include "common.servicename" . }}
20   replicas: {{ .Values.replicaCount }}
21   template:
22     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
23     spec:
24       initContainers:
25         - name: {{ include "common.name" . }}-readiness
26           image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
27           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
28           command:
29           - /app/ready.py
30           args:
31           - --container-name
32           - dmaap-dr-prov
33           env:
34           - name: NAMESPACE
35             valueFrom:
36               fieldRef:
37                 apiVersion: v1
38                 fieldPath: metadata.namespace
39         {{- if .Values.global.aafEnabled }}{{ include "common.aaf-config" . | nindent 8 }}{{ end }}
40         - name: {{ include "common.name" . }}-permission-fixer
41           image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
42           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43           volumeMounts: {{- if .Values.global.aafEnabled }}{{ include "common.aaf-config-volume-mountpath" . | nindent 10 }}{{ end }}
44           - mountPath: {{ .Values.persistence.spool.path }}
45             name: {{ include "common.fullname" . }}-spool
46           - mountPath: {{ .Values.persistence.event.path }}
47             name: {{ include "common.fullname" . }}-event-logs
48           command: ["chown","-Rf","1000:1001", "/opt/app/"]
49       containers:
50         - name: {{ include "common.name" . }}
51           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
52           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53           ports: {{ include "common.containerPorts" . | nindent 12  }}
54           {{- if eq .Values.liveness.enabled true }}
55           livenessProbe:
56             tcpSocket:
57               port: {{.Values.liveness.port}}
58             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
59             periodSeconds: {{ .Values.liveness.periodSeconds }}
60           {{ end -}}
61           readinessProbe:
62             tcpSocket:
63               port: {{.Values.readiness.port}}
64             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
65             periodSeconds: {{ .Values.readiness.periodSeconds }}
66           volumeMounts: {{- if .Values.global.aafEnabled }}{{ include "common.aaf-config-volume-mountpath" . | nindent 10 }}{{ end }}
67           - mountPath: {{ .Values.persistence.spool.path }}
68             name: {{ include "common.fullname" . }}-spool
69           - mountPath: {{ .Values.persistence.event.path }}
70             name: {{ include "common.fullname" . }}-event-logs
71           - mountPath: /etc/localtime
72             name: localtime
73             readOnly: false
74           - mountPath: /opt/app/datartr/etc/node.properties
75             name: {{ include "common.fullname" . }}-config
76             subPath: node.properties
77           - mountPath: /opt/app/datartr/etc/logback.xml
78             name: {{ include "common.fullname" . }}-log-conf
79             subPath: logback.xml
80           - mountPath: {{ .Values.global.loggingDirectory }}
81             name: {{ include "common.fullname" . }}-logs
82           resources: {{ include "common.resources" . | nindent 12 }}
83         {{- if .Values.nodeSelector }}
84         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
85         {{- end -}}
86         {{- if .Values.affinity }}
87         affinity: {{ toYaml .Values.affinity | nindent 10 }}
88         {{- end -}}
89         # Filebeat sidecar container
90         - name: {{ include "common.name" . }}-filebeat-onap
91           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
92           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93           volumeMounts:
94           - name: {{ include "common.fullname" . }}-filebeat-conf
95             mountPath: /usr/share/filebeat/filebeat.yml
96             subPath: filebeat.yml
97           - name: {{ include "common.fullname" . }}-data-filebeat
98             mountPath: /usr/share/filebeat/data
99           - name: {{ include "common.fullname" . }}-logs
100             mountPath: /var/log/onap/datarouter-node
101       imagePullSecrets:
102       - name: "{{ include "common.namespace" . }}-docker-registry-key"
103       volumes: {{ include "common.aaf-config-volumes" . | nindent 8 }}
104         - name: localtime
105           hostPath:
106             path: /etc/localtime
107         - name: {{ include "common.fullname" . }}-config
108           configMap:
109             name: {{ include "common.fullname" . }}-configmap
110             items:
111             - key: node.properties
112               path: node.properties
113         - name: {{ include "common.fullname" . }}-log-conf
114           configMap:
115             name: {{ include "common.fullname" . }}-log
116         - name: {{ include "common.fullname" . }}-filebeat-conf
117           configMap:
118             name: {{ include "common.fullname" . }}-dmaap-dr-node-filebeat-configmap
119         - name: {{ include "common.fullname" . }}-data-filebeat
120           emptyDir: {}
121         - name:  {{ include "common.fullname" . }}-logs
122           emptyDir: {}
123       {{- if not .Values.persistence.enabled }}
124         - name:  {{ include "common.fullname" . }}-event-logs
125           emptyDir: {}
126         - name: {{ include "common.fullname" . }}-spool
127           emptyDir: {}
128       {{- end }}
129 {{- if .Values.persistence.enabled }}
130   volumeClaimTemplates:
131   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "spool" "persistenceInfos" .Values.persistence.spool) | indent 4 | trim }}
132   - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "event-logs" "persistenceInfos" .Values.persistence.event) | indent 4 | trim }}
133 {{- end }}