74832848bb2f031a08b64035fd5cae125ecb49f6
[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 # Modifications Copyright © 2023 DTAG
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 */}}
19
20 apiVersion: apps/v1
21 kind: StatefulSet
22 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
23 spec:
24   selector: {{- include "common.selectors" . | nindent 4 }}
25   serviceName: {{ include "common.servicename" . }}
26   replicas: 1
27   template:
28     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
29     spec:
30       containers:
31         - name: {{ include "common.name" . }}
32           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
33           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
34           ports: {{ include "common.containerPorts" . | nindent 10  }}
35           {{- if eq .Values.liveness.enabled true }}
36           livenessProbe:
37             tcpSocket:
38               port: {{ .Values.liveness.port }}
39             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
40             periodSeconds: {{ .Values.liveness.periodSeconds }}
41             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
42             successThreshold: {{ .Values.liveness.successThreshold }}
43             failureThreshold: {{ .Values.liveness.failureThreshold }}
44           {{ end }}
45           readinessProbe:
46             tcpSocket:
47               port: {{ .Values.readiness.port }}
48             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
49             periodSeconds: {{ .Values.readiness.periodSeconds }}
50             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
51             successThreshold: {{ .Values.readiness.successThreshold }}
52             failureThreshold: {{ .Values.readiness.failureThreshold }}
53           startupProbe:
54             tcpSocket:
55                 port: {{ .Values.startup.port }}
56             initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
57             periodSeconds: {{ .Values.startup.periodSeconds }}
58             timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
59             successThreshold: {{ .Values.startup.successThreshold }}
60             failureThreshold: {{ .Values.startup.failureThreshold }}
61           env:
62           - name: JAASLOGIN
63             valueFrom:
64               secretKeyRef:
65                 name: strimzi-kafka-admin
66                 key: sasl.jaas.config
67           - name: SASLMECH
68             value: scram-sha-512
69           - name: enableCadi
70             value: "true"
71           - name: useZkTopicStore
72             value: "false"
73           volumeMounts:
74             - mountPath: /etc/localtime
75               name: localtime
76               readOnly: true
77             - mountPath: /appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
78               subPath: MsgRtrApi.properties
79               name: appprops
80             - mountPath: /appl/dmaapMR1/bundleconfig/etc/logback.xml
81               subPath: logback.xml
82               name: logback
83           resources: {{ include "common.resources" . | nindent 12 }}
84         - name: {{ .Values.zkTunnelService.name }}
85           image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.zkTunnelService.image }}
86           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
87           command:
88             - /opt/stunnel/stunnel_run.sh
89           ports:
90             - containerPort: {{ .Values.zkTunnelService.internalPort }}
91               name: {{ .Values.zkTunnelService.portName }}
92               protocol: {{ .Values.zkTunnelService.protocol }}
93           env:
94             - name: LOG_LEVEL
95               value: {{ .Values.zkTunnelService.logLevel }}
96             - name: STRIMZI_ZOOKEEPER_CONNECT
97               value: '{{ include "common.release" . }}-strimzi-zookeeper-client:{{ .Values.zkTunnelService.internalPort }}'
98           livenessProbe:
99             exec:
100               command:
101                 - /opt/stunnel/stunnel_healthcheck.sh
102                 - '{{ .Values.zkTunnelService.internalPort }}'
103             failureThreshold: 3
104             initialDelaySeconds: 15
105             periodSeconds: 10
106             successThreshold: 1
107             timeoutSeconds: 5
108           readinessProbe:
109             exec:
110               command:
111                 - /opt/stunnel/stunnel_healthcheck.sh
112                 - '{{ .Values.zkTunnelService.internalPort }}'
113             failureThreshold: 3
114             initialDelaySeconds: 15
115             periodSeconds: 10
116             successThreshold: 1
117             timeoutSeconds: 5
118           volumeMounts:
119             - mountPath: /etc/cluster-operator-certs/
120               name: cluster-operator-certs
121             - mountPath: /etc/cluster-ca-certs/
122               name: cluster-ca-certs
123       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
124       volumes:
125         - name: localtime
126           hostPath:
127             path: /etc/localtime
128         - name: appprops
129           configMap:
130             name: {{ include "common.fullname" . }}-msgrtrapi-prop-configmap
131         - name: logback
132           configMap:
133             name: {{ include "common.fullname" . }}-logback-xml-configmap
134         - name: cluster-operator-certs
135           secret:
136             defaultMode: 288
137             secretName: {{ include "common.release" . }}-strimzi-cluster-operator-certs
138         - name: cluster-ca-certs
139           secret:
140             defaultMode: 288
141             secretName: {{ include "common.release" . }}-strimzi-cluster-ca-cert
142       {{- include "common.imagePullSecrets" . | nindent 6 }}
143 ---
144 apiVersion: networking.k8s.io/v1
145 kind: NetworkPolicy
146 metadata:
147   name: {{ include "common.fullname" . }}-zk-network-policy
148   namespace: {{ include "common.namespace" . }}
149 spec:
150   podSelector:
151     matchLabels:
152       strimzi.io/name: {{ include "common.release" . }}-strimzi-zookeeper
153   ingress:
154   - from:
155     - podSelector:
156         matchLabels:
157           app.kubernetes.io/name: {{ include "common.name" . }}
158     ports:
159     - port: {{ .Values.zkTunnelService.internalPort }}
160       protocol: {{ .Values.zkTunnelService.protocol }}
161   policyTypes:
162   - Ingress