Repository navigation
Expand file tree
/
Copy pathkafka.yaml
More file actions
108 lines (108 loc) · 3.9 KB
/
Copy pathkafka.yaml
File metadata and controls
108 lines (108 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{{- /*
Tri-state TLS logic for the external listener (port 9094):
- .Values.external is the sole gate for the external LoadBalancer listener.
The listener is rendered if and only if external is true.
- tls.enabled controls TLS *on the external listener* (independent of whether
the listener exists):
- If tls.enabled is explicitly set (true or false), that value wins.
- If tls.enabled is unset (nil / absent), TLS inherits from .Values.external
(auto-on when external is true, off otherwise).
- tls.enabled does NOT control whether the external listener is created.
Setting tls.enabled=true with external=false has no effect on listeners.
Internal TLS listener (port 9093) is always on; Strimzi manages the PKI.
Null detection uses `kindIs "invalid"` (canonical pattern) — see _tls.tpl.
*/ -}}
{{- include "kafka.assertNameLength" . -}}
{{- $tlsEnabled := include "kafka.tls.enabled" . | trim -}}
{{- $showExternal := .Values.external -}}
{{- $kafkaVersion := include "kafka.versionMap" . -}}
{{- $entityOperatorMemory := "512Mi" -}}
apiVersion: kafka.strimzi.io/v1
kind: Kafka
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
kafka:
version: {{ $kafkaVersion }}
listeners:
- name: plain
port: 9092
type: internal
tls: false
- name: tls
port: 9093
type: internal
tls: true
{{- if $showExternal }}
- name: external
port: 9094
type: loadbalancer
tls: {{ $tlsEnabled }}
{{- end }}
config:
{{- if eq (int .Values.kafka.replicas) 1 }}
offsets.topic.replication.factor: 1
transaction.state.log.replication.factor: 1
transaction.state.log.min.isr: 1
default.replication.factor: 1
min.insync.replicas: 1
{{- else if eq (int .Values.kafka.replicas) 2 }}
offsets.topic.replication.factor: 2
transaction.state.log.replication.factor: 2
transaction.state.log.min.isr: 2
default.replication.factor: 2
min.insync.replicas: 2
{{- else }}
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
default.replication.factor: 3
min.insync.replicas: 2
{{- end }}
template:
pod:
metadata:
labels:
# The nodes read their certificates from Secrets through the
# Kubernetes API (Strimzi's strimzisecrets config provider).
policy.cozystack.io/allow-to-apiserver: "true"
metricsConfig:
type: jmxPrometheusExporter
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-metrics
key: kafka-metrics-config.yml
entityOperator:
# Tenant namespaces ship a LimitRange that defaults containers to 128Mi.
# The topic-operator and user-operator are JVM processes and OOMKill at
# that default, leaving the entity-operator in CrashLoopBackOff so
# KafkaTopics/KafkaUsers never reconcile. Set explicit resources so they
# don't inherit the namespace default.
topicOperator:
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: {{ $entityOperatorMemory }}
userOperator:
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: {{ $entityOperatorMemory }}
template:
# `pod` accepts metadata + a flat set of pod-spec fields
# (enableServiceLinks, securityContext, affinity, …) directly.
# The previous file nested enableServiceLinks under a phantom
# `template.spec` key — Flux v2.7 dropped it silently, v2.8 SSA
# rejects it with "field not declared in schema".
pod:
metadata:
labels:
policy.cozystack.io/allow-to-apiserver: "true"
enableServiceLinks: false