Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / strimzi / templates / strimzi-kafka.yaml
1 {{/*
2 # Copyright © 2022 Nordix Foundation
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: kafka.strimzi.io/v1beta2
17 kind: Kafka
18 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
19 spec:
20   kafka:
21     version: {{ .Values.config.kafkaVersion }}
22     replicas: {{ .Values.replicaCount }}
23     listeners:
24       - name: plain
25         port: {{ .Values.config.kafkaInternalPort }}
26         type: internal
27         tls: false
28         authentication:
29           type: {{ .Values.config.saslMechanism }}
30       - name: tls
31         port: 9093
32         type: internal
33         tls: true
34         authentication:
35           type: tls
36       - name: external
37         port: 9094
38         type: {{ if (include "common.ingressEnabled" .) }}cluster-ip{{ else }}nodeport{{ end }}
39         tls: {{ if (include "common.ingressEnabled" .) }}false{{ else }}true{{ end }}
40         authentication:
41           type: {{ if (include "common.ingressEnabled" .) }}{{ .Values.config.saslMechanism }}{{ else }}tls{{ end }}
42         configuration:
43           {{- if not (include "common.ingressEnabled" .) }}
44           bootstrap:
45             nodePort: {{ .Values.global.nodePortPrefixExt }}93
46           {{- end }}
47           brokers:
48             - broker: 0
49               advertisedHost: {{ .Values.config.advertisedHost }}
50               advertisedPort: {{ .Values.config.advertizedPortBroker0 }}
51               {{- if not (include "common.ingressEnabled" .) }}
52               nodePort: {{ .Values.global.nodePortPrefixExt }}90
53               {{- end }}
54             - broker: 1
55               advertisedHost: {{ .Values.config.advertisedHost }}
56               advertisedPort: {{ .Values.config.advertizedPortBroker1 }}
57               {{- if not (include "common.ingressEnabled" .) }}
58               nodePort: {{ .Values.global.nodePortPrefixExt }}91
59               {{- end }}
60             - broker: 2
61               advertisedHost: {{ .Values.config.advertisedHost }}
62               advertisedPort: {{ .Values.config.advertizedPortBroker2 }}
63               {{- if not (include "common.ingressEnabled" .) }}
64               nodePort: {{ .Values.global.nodePortPrefixExt }}92
65               {{- end }}
66     authorization:
67       type: {{ .Values.config.authType }}
68       superUsers:
69         - {{ .Values.config.strimziKafkaAdminUser }}
70     template:
71       pod:
72         {{- include "common.imagePullSecrets" . | nindent 8 }}
73         securityContext:
74           runAsUser: 0
75           fsGroup: 0
76         {{- if .Values.affinity.podAntiAffinity.enabled }}
77         affinity:
78           podAntiAffinity:
79             requiredDuringSchedulingIgnoredDuringExecution:
80               - labelSelector:
81                   matchExpressions:
82                     - key: strimzi.io/name
83                       operator: In
84                       values:
85                         - {{ include "common.fullname" . }}-kafka
86                 topologyKey: "kubernetes.io/hostname"
87         {{- end }}
88     config:
89       default.replication.factor: {{ .Values.replicaCount }}
90       min.insync.replicas: {{ (eq 1.0 (.Values.replicaCount)) | ternary 1 (sub .Values.replicaCount 1) }}
91       offsets.topic.replication.factor: {{ .Values.replicaCount }}
92       num.partitions: {{ mul .Values.replicaCount 2 }}
93       transaction.state.log.replication.factor: {{ .Values.replicaCount }}
94       transaction.state.log.min.isr: {{ (eq 1.0 (.Values.replicaCount)) | ternary 1 (sub .Values.replicaCount 1) }}
95       log.message.format.version: {{ .Values.config.kafkaVersion }}
96       inter.broker.protocol.version: {{ .Values.config.kafkaVersion }}
97       auto.create.topics.enable: {{ .Values.config.autoCreateTopics }}
98     storage:
99       type: jbod
100       volumes:
101       - id: 0
102         type: persistent-claim
103         size: {{ .Values.persistence.kafka.size }}
104         deleteClaim: true
105         class: {{ include "common.storageClass" (dict "dot" . "suffix" "kafka" "persistenceInfos" .Values.persistence.kafka) }}
106     {{- if .Values.metrics.kafkaExporter.enabled }}
107     metricsConfig:
108       type: {{ .Values.metrics.kafkaExporter.metricsConfig.type }}
109       valueFrom:
110         configMapKeyRef:
111           name: {{ include "common.fullname" . }}
112           key: kafka-metrics-config.yml
113     {{- end }}
114   zookeeper:
115     template:
116       pod:
117         {{- include "common.imagePullSecrets" . | nindent 8 }}
118         securityContext:
119           runAsUser: 0
120           fsGroup: 0
121         {{- if .Values.affinity.podAntiAffinity.enabled }}
122         affinity:
123           podAntiAffinity:
124             requiredDuringSchedulingIgnoredDuringExecution:
125               - labelSelector:
126                   matchExpressions:
127                     - key: strimzi.io/name
128                       operator: In
129                       values:
130                         - {{ include "common.fullname" . }}-zookeeper
131                 topologyKey: "kubernetes.io/hostname"
132         {{- end }}
133     replicas: {{ .Values.replicaCount }}
134     config:
135       ssl.hostnameVerification: false
136       ssl.quorum.hostnameVerification: false
137       {{- if (include "common.onServiceMesh" .) }}
138       sslQuorum: false
139       {{- end }}
140     storage:
141       type: persistent-claim
142       size: {{ .Values.persistence.zookeeper.size }}
143       deleteClaim: true
144       class: {{ include "common.storageClass" (dict "dot" . "suffix" "zk" "persistenceInfos" .Values.persistence.zookeeper) }}
145     {{- if .Values.metrics.kafkaExporter.enabled }}
146     metricsConfig:
147       type: {{ .Values.metrics.kafkaExporter.metricsConfig.type }}
148       valueFrom:
149         configMapKeyRef:
150           name: {{ include "common.fullname" . }}
151           key: zookeeper-metrics-config.yml
152     {{- end }}
153   entityOperator:
154     template:
155       pod:
156         {{- include "common.imagePullSecrets" . | nindent 8 }}
157     topicOperator: {}
158     userOperator: {}
159   {{- if .Values.cruiseControl.enabled }}
160   cruiseControl:
161     template:
162       pod:
163         {{- include "common.imagePullSecrets" . | nindent 8 }}
164     metricsConfig:
165       type: {{ .Values.cruiseControl.metricsConfig.type }}
166       valueFrom:
167         configMapKeyRef:
168           name: {{ include "common.fullname" . }}
169           key: cruisecontrol-metrics-config.yml
170   {{- end }}
171   {{- if .Values.metrics.kafkaExporter.enabled }}
172   kafkaExporter:
173     template:
174       pod:
175         {{- include "common.imagePullSecrets" . | nindent 8 }}
176     topicRegex: {{ .Values.metrics.kafkaExporter.topicRegex }}
177     groupRegex: {{ .Values.metrics.kafkaExporter.groupRegex }}
178     resources:
179       requests:
180         cpu: {{ .Values.metrics.kafkaExporter.resources.requests.cpu }}
181         memory: {{ .Values.metrics.kafkaExporter.resources.requests.memory }}
182       limits:
183         cpu: {{ .Values.metrics.kafkaExporter.resources.limits.cpu }}
184         memory: {{ .Values.metrics.kafkaExporter.resources.limits.memory }}
185     logging: {{ .Values.metrics.kafkaExporter.logging }}
186     enableSaramaLogging: {{ .Values.metrics.kafkaExporter.enableSaramaLogging }}
187     readinessProbe:
188       initialDelaySeconds: {{ .Values.metrics.kafkaExporter.readinessProbe.initialDelaySeconds }}
189       timeoutSeconds: {{ .Values.metrics.kafkaExporter.readinessProbe.timeoutSeconds }}
190     livenessProbe:
191       initialDelaySeconds: {{ .Values.metrics.kafkaExporter.livenessProbe.initialDelaySeconds }}
192       timeoutSeconds: {{ .Values.metrics.kafkaExporter.livenessProbe.timeoutSeconds }}
193   {{- end }}