[STRIMZI] Correction for external Access via Ingress
[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         securityContext:
73           runAsUser: 0
74           fsGroup: 0
75     config:
76       default.replication.factor: {{ .Values.replicaCount }}
77       min.insync.replicas: {{ (eq 1.0 (.Values.replicaCount)) | ternary 1 (sub .Values.replicaCount 1) }}
78       offsets.topic.replication.factor: {{ .Values.replicaCount }}
79       num.partitions: {{ mul .Values.replicaCount 2 }}
80       transaction.state.log.replication.factor: {{ .Values.replicaCount }}
81       transaction.state.log.min.isr: {{ (eq 1.0 (.Values.replicaCount)) | ternary 1 (sub .Values.replicaCount 1) }}
82       log.message.format.version: {{ .Values.config.kafkaVersion }}
83       inter.broker.protocol.version: {{ .Values.config.kafkaVersion }}
84     storage:
85       type: jbod
86       volumes:
87       - id: 0
88         type: persistent-claim
89         size: {{ .Values.persistence.kafka.size }}
90         deleteClaim: true
91         class: {{ include "common.storageClass" (dict "dot" . "suffix" "kafka" "persistenceInfos" .Values.persistence.kafka) }}
92   zookeeper:
93     template:
94       pod:
95         securityContext:
96           runAsUser: 0
97           fsGroup: 0
98     replicas: {{ .Values.replicaCount }}
99     config:
100       ssl.hostnameVerification: false
101       ssl.quorum.hostnameVerification: false
102       {{- if (include "common.onServiceMesh" .) }}
103       sslQuorum: false
104       {{- end }}
105     storage:
106       type: persistent-claim
107       size: {{ .Values.persistence.zookeeper.size }}
108       deleteClaim: true
109       class: {{ include "common.storageClass" (dict "dot" . "suffix" "zk" "persistenceInfos" .Values.persistence.zookeeper) }}
110   entityOperator:
111     topicOperator: {}
112     userOperator: {}
113