[DMAAP] Update Kohn versions
[oom.git] / kubernetes / dmaap / components / message-router / templates / statefulset.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T
4 # Modifications Copyright © 2021-2022 Nordix Foundation
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: StatefulSet
21 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
22 spec:
23   selector: {{- include "common.selectors" . | nindent 4 }}
24   serviceName: {{ include "common.servicename" . }}
25   replicas: {{ .Values.replicaCount }}
26   template:
27     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
28     spec:
29       initContainers:
30       {{ include "common.certInitializer.initContainer" . | indent 6 | trim }}
31       {{- if  .Values.global.aafEnabled }}
32       - name: {{ include "common.name" . }}-update-config
33         command:
34         - sh
35         args:
36         - -c
37         - |
38           export $(cat {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop | xargs -0);
39           cd /config-input  && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done
40         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
41         - mountPath: /config
42           name: jetty
43         - mountPath: /config-input
44           name: etc
45         image: {{ include "repositoryGenerator.image.envsubst" . }}
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47       {{- end }}
48       containers:
49       {{- if .Values.prometheus.jmx.enabled }}
50         - name: prometheus-jmx-exporter
51           image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.prometheus.jmx.image }}:{{ .Values.prometheus.jmx.imageTag }}
52           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53           command:
54           - java
55           - -XX:+UnlockExperimentalVMOptions
56           - -XX:+UseCGroupMemoryLimitForHeap
57           - -XX:MaxRAMFraction=1
58           - -XshowSettings:vm
59           - -jar
60           - jmx_prometheus_httpserver.jar
61           - {{ .Values.prometheus.jmx.port | quote }}
62           - /etc/jmx-kafka/jmx-mrservice-prometheus.yml
63           ports:
64           - containerPort: {{ .Values.prometheus.jmx.port }}
65           resources:
66           volumeMounts:
67           - name: jmx-config
68             mountPath: /etc/jmx-kafka
69       {{- end }}
70         - name: srimzi-zk-entrance
71           image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.zookeeper.entrance.image }}
72           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
73           command:
74             - /opt/stunnel/stunnel_run.sh
75           ports:
76             - containerPort: {{ .Values.global.zkTunnelService.internalPort }}
77               name: zoo
78               protocol: TCP
79           env:
80             - name: LOG_LEVEL
81               value: debug
82             - name: STRIMZI_ZOOKEEPER_CONNECT
83               value: '{{ include "common.release" . }}-strimzi-zookeeper-client:{{ .Values.global.zkTunnelService.internalPort }}'
84           livenessProbe:
85             exec:
86               command:
87                 - /opt/stunnel/stunnel_healthcheck.sh
88                 - '{{ .Values.global.zkTunnelService.internalPort }}'
89             failureThreshold: 3
90             initialDelaySeconds: 15
91             periodSeconds: 10
92             successThreshold: 1
93             timeoutSeconds: 5
94           readinessProbe:
95             exec:
96               command:
97                 - /opt/stunnel/stunnel_healthcheck.sh
98                 - '{{ .Values.global.zkTunnelService.internalPort }}'
99             failureThreshold: 3
100             initialDelaySeconds: 15
101             periodSeconds: 10
102             successThreshold: 1
103             timeoutSeconds: 5
104           volumeMounts:
105             - mountPath: /etc/cluster-operator-certs/
106               name: cluster-operator-certs
107             - mountPath: /etc/cluster-ca-certs/
108               name: cluster-ca-certs
109         - name: {{ include "common.name" . }}
110           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
111           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
112           {{- if  .Values.global.aafEnabled }}
113           command:
114           - sh
115           args:
116           - -c
117           - |
118             cp /jetty-config/ajsc-jetty.xml /appl/dmaapMR1/etc/
119             cp /jetty-config/cadi.properties {{ .Values.certInitializer.appMountPath }}/local/cadi.properties
120             /bin/sh /appl/startup.sh
121           {{- end }}
122           ports: {{ include "common.containerPorts" . | nindent 10  }}
123           {{- if eq .Values.liveness.enabled true }}
124           livenessProbe:
125             tcpSocket:
126               port: {{ .Values.liveness.port }}
127             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
128             periodSeconds: {{ .Values.liveness.periodSeconds }}
129             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
130             successThreshold: {{ .Values.liveness.successThreshold }}
131             failureThreshold: {{ .Values.liveness.failureThreshold }}
132           {{ end }}
133           readinessProbe:
134             tcpSocket:
135               port: {{ .Values.readiness.port }}
136             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
137             periodSeconds: {{ .Values.readiness.periodSeconds }}
138             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
139             successThreshold: {{ .Values.readiness.successThreshold }}
140             failureThreshold: {{ .Values.readiness.failureThreshold }}
141           startupProbe:
142             tcpSocket:
143                 port: {{ .Values.startup.port }}
144             initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
145             periodSeconds: {{ .Values.startup.periodSeconds }}
146             timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
147             successThreshold: {{ .Values.startup.successThreshold }}
148             failureThreshold: {{ .Values.startup.failureThreshold }}
149           env:
150           - name: JAASLOGIN
151             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "mr-kafka-admin-secret" "key" "sasl.jaas.config") | indent 12 }}
152           - name: SASLMECH
153             value: {{ .Values.global.saslMechanism }}
154           - name: enableCadi
155             value: "{{ .Values.global.aafEnabled }}"
156           - name: useZkTopicStore
157             value: "false"
158           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
159           - mountPath: /etc/localtime
160             name: localtime
161             readOnly: true
162           - mountPath: /appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
163             subPath: MsgRtrApi.properties
164             name: appprops
165           - mountPath: /appl/dmaapMR1/bundleconfig/etc/logback.xml
166             subPath: logback.xml
167             name: logback
168           {{- if  .Values.global.aafEnabled }}
169           - mountPath: /appl/dmaapMR1/etc/runner-web.xml
170             subPath: runner-web.xml
171             name: etc
172           - mountPath: /appl/dmaapMR1/bundleconfig/etc/sysprops/sys-props.properties
173             subPath: sys-props.properties
174             name: sys-props
175           - mountPath: /jetty-config
176             name: jetty
177           {{- end }}
178           resources: {{ include "common.resources" . | nindent 12 }}
179       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
180       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
181         - name: localtime
182           hostPath:
183             path: /etc/localtime
184         - name: appprops
185           configMap:
186             name: {{ include "common.fullname" . }}-msgrtrapi-prop-configmap
187         - name: etc
188           configMap:
189             name: {{ include "common.fullname" . }}-etc
190         - name: logback
191           configMap:
192             name: {{ include "common.fullname" . }}-logback-xml-configmap
193         {{- if .Values.prometheus.jmx.enabled }}
194         - name: jmx-config
195           configMap:
196             name: {{ include "common.fullname" . }}-prometheus-configmap
197         {{- end }}
198         - name: sys-props
199           configMap:
200             name: {{ include "common.fullname" . }}-sys-props
201         - name: jetty
202           emptyDir: {}
203         - name: cluster-operator-certs
204           secret:
205             defaultMode: 288
206             secretName: {{ include "common.release" . }}-strimzi-cluster-operator-certs
207         - name: cluster-ca-certs
208           secret:
209             defaultMode: 288
210             secretName: {{ include "common.release" . }}-strimzi-cluster-ca-cert
211       imagePullSecrets:
212       - name: "{{ include "common.namespace" . }}-docker-registry-key"
213 ---
214 apiVersion: networking.k8s.io/v1
215 kind: NetworkPolicy
216 metadata:
217   name: {{ include "common.fullname" . }}-zk-network-policy
218   namespace: {{ include "common.namespace" . }}
219 spec:
220   podSelector:
221     matchLabels:
222       strimzi.io/name: {{ include "common.release" . }}-strimzi-zookeeper
223   ingress:
224   - from:
225     - podSelector:
226         matchLabels:
227           app.kubernetes.io/name: {{ include "common.name" . }}
228     ports:
229     - port: {{ .Values.global.zkTunnelService.internalPort }}
230       protocol: TCP
231   policyTypes:
232   - Ingress