Skip to content

Commit f49e853

Browse files
committed
add strimzi cluster
1 parent 9e7eee7 commit f49e853

10 files changed

Lines changed: 492 additions & 0 deletions

File tree

charts/strimzi-cluster/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/strimzi-cluster/Chart.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: common
3+
repository: oci://registry-1.docker.io/bitnamicharts
4+
version: 2.29.1
5+
digest: sha256:41cbd2c5bdbcd8628926a106dea688e58e38e2c53e80f8ab0ed357ddbfa088d9
6+
generated: "2025-02-13T12:19:34.082086+03:00"

charts/strimzi-cluster/Chart.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: strimzi-cluster
3+
description: A Helm chart to deploy a Kafka cluster using Strimzi
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
dependencies:
21+
- name: common
22+
version: 2.x.x
23+
repository: oci://registry-1.docker.io/bitnamicharts
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "strimzi-cluster.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "strimzi-cluster.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "strimzi-cluster.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "strimzi-cluster.labels" -}}
37+
app.kubernetes.io/name: {{ include "strimzi-cluster.name" . }}
38+
app.kubernetes.io/instance: {{ .Release.Name }}
39+
helm.sh/chart: {{ include "strimzi-cluster.chart" . }}
40+
{{- if .Chart.AppVersion }}
41+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42+
{{- end }}
43+
app.kubernetes.io/managed-by: {{ .Release.Service }}
44+
{{- end }}
45+
46+
{{/*
47+
Name of the cluster being deployed
48+
*/}}
49+
{{- define "strimzi-cluster.clusterName" -}}
50+
{{ .Values.cluster.name | default (include "strimzi-cluster.fullname" .) }}
51+
{{- end }}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
apiVersion: kafka.strimzi.io/v1beta2
2+
kind: Kafka
3+
metadata:
4+
name: {{ include "strimzi-cluster.clusterName" . }}
5+
annotations:
6+
{{- with .Values.cluster.annotations -}}
7+
{{ . | toYaml | nindent 4 }}
8+
{{- end }}
9+
{{- include "strimzi-cluster.labels" . | nindent 4 }}
10+
strimzi.io/kraft: enabled
11+
strimzi.io/node-pools: enabled
12+
{{- with .Values.cluster.labels }}
13+
labels:
14+
{{ . | toYaml | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
{{ if hasKey .Values.cluster "entityOperator" }}
18+
entityOperator:
19+
{{- .Values.cluster.entityOperator | toYaml | nindent 4 }}
20+
{{- end }}
21+
{{ if hasKey .Values.cluster "kafkaExporter" }}
22+
kafkaExporter:
23+
{{- .Values.cluster.kafkaExporter | toYaml | nindent 4 }}
24+
{{- end }}
25+
kafka:
26+
{{- if .Values.cluster.jmxMetrics.enabled }}
27+
metricsConfig:
28+
type: jmxPrometheusExporter
29+
valueFrom:
30+
configMapKeyRef:
31+
name: {{ include "strimzi-cluster.fullname" $ }}-jmx-metrics
32+
key: kafka-metrics-config.yml
33+
{{- end }}
34+
listeners:
35+
{{- .Values.cluster.listeners | toYaml | nindent 6 }}
36+
{{- with $.Values.cluster.config }}
37+
config:
38+
{{- $.Values.cluster.config | toYaml | nindent 6 }}
39+
{{- end }}
40+
template:
41+
pod:
42+
metadata:
43+
{{- with .Values.cluster.pod.labels }}
44+
labels:
45+
{{- . | toYaml | nindent 12 }}
46+
{{- end }}
47+
{{- with .Values.cluster.pod.annotations }}
48+
annotations:
49+
{{- . | toYaml | nindent 12 }}
50+
{{- end }}
51+
{{- if $.Values.affinity }}
52+
affinity:
53+
{{- include "common.tplvalues.render" ( dict "value" $.Values.affinity "context" $) | nindent 12 }}
54+
{{- else }}
55+
affinity:
56+
{{- $podLabels := dict "strimzi.io/cluster" (include "strimzi-cluster.clusterName" $) "strimzi.io/component-type" "kafka" }}
57+
podAffinity:
58+
{{- include "common.affinities.pods" (dict "type" $.Values.podAffinityPreset "extraMatchLabels" $podLabels "context" $) | nindent 14 }}
59+
podAntiAffinity:
60+
{{- include "common.affinities.pods" (dict "type" $.Values.podAntiAffinityPreset "extraMatchLabels" $podLabels "context" $) | nindent 14 }}
61+
nodeAffinity:
62+
{{- include "common.affinities.nodes" (dict "type" $.Values.nodeAffinityPreset.type "key" $.Values.nodeAffinityPreset.key "values" $.Values.nodeAffinityPreset.values) | nindent 14 }}
63+
{{- end }}
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{{- if .Values.cluster.jmxMetrics.enabled -}}
2+
kind: ConfigMap
3+
apiVersion: v1
4+
metadata:
5+
name: {{ include "strimzi-cluster.fullname" $ }}-jmx-metrics
6+
labels:
7+
{{- include "strimzi-cluster.labels" $ | nindent 4 }}
8+
data:
9+
# See https://github.com/strimzi/strimzi-kafka-operator/blob/main/examples/metrics/kafka-metrics.yaml
10+
kafka-metrics-config.yml: |
11+
# See https://github.com/prometheus/jmx_exporter for more info about JMX Prometheus Exporter metrics
12+
lowercaseOutputName: true
13+
rules:
14+
# Special cases and very specific rules
15+
- pattern: kafka.server<type=(.+), name=(.+), clientId=(.+), topic=(.+), partition=(.*)><>Value
16+
name: kafka_server_$1_$2
17+
type: GAUGE
18+
labels:
19+
clientId: "$3"
20+
topic: "$4"
21+
partition: "$5"
22+
- pattern: kafka.server<type=(.+), name=(.+), clientId=(.+), brokerHost=(.+), brokerPort=(.+)><>Value
23+
name: kafka_server_$1_$2
24+
type: GAUGE
25+
labels:
26+
clientId: "$3"
27+
broker: "$4:$5"
28+
- pattern: kafka.server<type=(.+), cipher=(.+), protocol=(.+), listener=(.+), networkProcessor=(.+)><>connections
29+
name: kafka_server_$1_connections_tls_info
30+
type: GAUGE
31+
labels:
32+
cipher: "$2"
33+
protocol: "$3"
34+
listener: "$4"
35+
networkProcessor: "$5"
36+
- pattern: kafka.server<type=(.+), clientSoftwareName=(.+), clientSoftwareVersion=(.+), listener=(.+), networkProcessor=(.+)><>connections
37+
name: kafka_server_$1_connections_software
38+
type: GAUGE
39+
labels:
40+
clientSoftwareName: "$2"
41+
clientSoftwareVersion: "$3"
42+
listener: "$4"
43+
networkProcessor: "$5"
44+
- pattern: "kafka.server<type=(.+), listener=(.+), networkProcessor=(.+)><>(.+-total):"
45+
name: kafka_server_$1_$4
46+
type: COUNTER
47+
labels:
48+
listener: "$2"
49+
networkProcessor: "$3"
50+
- pattern: "kafka.server<type=(.+), listener=(.+), networkProcessor=(.+)><>(.+):"
51+
name: kafka_server_$1_$4
52+
type: GAUGE
53+
labels:
54+
listener: "$2"
55+
networkProcessor: "$3"
56+
- pattern: kafka.server<type=(.+), listener=(.+), networkProcessor=(.+)><>(.+-total)
57+
name: kafka_server_$1_$4
58+
type: COUNTER
59+
labels:
60+
listener: "$2"
61+
networkProcessor: "$3"
62+
- pattern: kafka.server<type=(.+), listener=(.+), networkProcessor=(.+)><>(.+)
63+
name: kafka_server_$1_$4
64+
type: GAUGE
65+
labels:
66+
listener: "$2"
67+
networkProcessor: "$3"
68+
# Some percent metrics use MeanRate attribute
69+
# Ex) kafka.server<type=(KafkaRequestHandlerPool), name=(RequestHandlerAvgIdlePercent)><>MeanRate
70+
- pattern: kafka.(\w+)<type=(.+), name=(.+)Percent\w*><>MeanRate
71+
name: kafka_$1_$2_$3_percent
72+
type: GAUGE
73+
# Generic gauges for percents
74+
- pattern: kafka.(\w+)<type=(.+), name=(.+)Percent\w*><>Value
75+
name: kafka_$1_$2_$3_percent
76+
type: GAUGE
77+
- pattern: kafka.(\w+)<type=(.+), name=(.+)Percent\w*, (.+)=(.+)><>Value
78+
name: kafka_$1_$2_$3_percent
79+
type: GAUGE
80+
labels:
81+
"$4": "$5"
82+
# Generic per-second counters with 0-2 key/value pairs
83+
- pattern: kafka.(\w+)<type=(.+), name=(.+)PerSec\w*, (.+)=(.+), (.+)=(.+)><>Count
84+
name: kafka_$1_$2_$3_total
85+
type: COUNTER
86+
labels:
87+
"$4": "$5"
88+
"$6": "$7"
89+
- pattern: kafka.(\w+)<type=(.+), name=(.+)PerSec\w*, (.+)=(.+)><>Count
90+
name: kafka_$1_$2_$3_total
91+
type: COUNTER
92+
labels:
93+
"$4": "$5"
94+
- pattern: kafka.(\w+)<type=(.+), name=(.+)PerSec\w*><>Count
95+
name: kafka_$1_$2_$3_total
96+
type: COUNTER
97+
# Generic gauges with 0-2 key/value pairs
98+
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+), (.+)=(.+)><>Value
99+
name: kafka_$1_$2_$3
100+
type: GAUGE
101+
labels:
102+
"$4": "$5"
103+
"$6": "$7"
104+
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+)><>Value
105+
name: kafka_$1_$2_$3
106+
type: GAUGE
107+
labels:
108+
"$4": "$5"
109+
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>Value
110+
name: kafka_$1_$2_$3
111+
type: GAUGE
112+
# Emulate Prometheus 'Summary' metrics for the exported 'Histogram's.
113+
# Note that these are missing the '_sum' metric!
114+
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+), (.+)=(.+)><>Count
115+
name: kafka_$1_$2_$3_count
116+
type: COUNTER
117+
labels:
118+
"$4": "$5"
119+
"$6": "$7"
120+
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.*), (.+)=(.+)><>(\d+)thPercentile
121+
name: kafka_$1_$2_$3
122+
type: GAUGE
123+
labels:
124+
"$4": "$5"
125+
"$6": "$7"
126+
quantile: "0.$8"
127+
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.+)><>Count
128+
name: kafka_$1_$2_$3_count
129+
type: COUNTER
130+
labels:
131+
"$4": "$5"
132+
- pattern: kafka.(\w+)<type=(.+), name=(.+), (.+)=(.*)><>(\d+)thPercentile
133+
name: kafka_$1_$2_$3
134+
type: GAUGE
135+
labels:
136+
"$4": "$5"
137+
quantile: "0.$6"
138+
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>Count
139+
name: kafka_$1_$2_$3_count
140+
type: COUNTER
141+
- pattern: kafka.(\w+)<type=(.+), name=(.+)><>(\d+)thPercentile
142+
name: kafka_$1_$2_$3
143+
type: GAUGE
144+
labels:
145+
quantile: "0.$4"
146+
# KRaft overall related metrics
147+
# distinguish between always increasing COUNTER (total and max) and variable GAUGE (all others) metrics
148+
- pattern: "kafka.server<type=raft-metrics><>(.+-total|.+-max):"
149+
name: kafka_server_raftmetrics_$1
150+
type: COUNTER
151+
- pattern: "kafka.server<type=raft-metrics><>(current-state): (.+)"
152+
name: kafka_server_raftmetrics_$1
153+
value: 1
154+
type: UNTYPED
155+
labels:
156+
$1: "$2"
157+
- pattern: "kafka.server<type=raft-metrics><>(.+):"
158+
name: kafka_server_raftmetrics_$1
159+
type: GAUGE
160+
# KRaft "low level" channels related metrics
161+
# distinguish between always increasing COUNTER (total and max) and variable GAUGE (all others) metrics
162+
- pattern: "kafka.server<type=raft-channel-metrics><>(.+-total|.+-max):"
163+
name: kafka_server_raftchannelmetrics_$1
164+
type: COUNTER
165+
- pattern: "kafka.server<type=raft-channel-metrics><>(.+):"
166+
name: kafka_server_raftchannelmetrics_$1
167+
type: GAUGE
168+
# Broker metrics related to fetching metadata topic records in KRaft mode
169+
- pattern: "kafka.server<type=broker-metadata-metrics><>(.+):"
170+
name: kafka_server_brokermetadatametrics_$1
171+
type: GAUGE
172+
{{- end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- range $pool := .Values.pools -}}
2+
apiVersion: kafka.strimzi.io/v1beta2
3+
kind: KafkaNodePool
4+
metadata:
5+
name: {{ $pool.name | required "pool name required" | quote }}
6+
labels:
7+
{{- with $pool.labels }}
8+
{{- . | toYaml | nindent 4 }}
9+
{{- end }}
10+
{{- include "strimzi-cluster.labels" $ | nindent 4 }}
11+
strimzi.io/cluster: {{ include "strimzi-cluster.clusterName" $ }}
12+
{{- with $pool.annotations }}
13+
annotations:
14+
{{- . | toYaml | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
{{- $pool.spec | toYaml | nindent 2 }}
18+
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- if .Values.podMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: {{ .Values.podMonitor.name | default (include "strimzi-cluster.clusterName" $) }}
6+
labels:
7+
{{- include "strimzi-cluster.labels" $ | nindent 4 }}
8+
spec:
9+
podMetricsEndpoints:
10+
- interval: {{ .Values.podMonitor.interval | quote }}
11+
path: /metrics
12+
targetPort: tcp-prometheus
13+
scheme: http
14+
selector:
15+
matchExpressions:
16+
- key: strimzi.io/cluster
17+
operator: In
18+
values: [{{ include "strimzi-cluster.clusterName" $ }}]
19+
- key: strimzi.io/component-type
20+
operator: In
21+
values:
22+
- kafka
23+
- kafka-exporter
24+
{{- end }}

0 commit comments

Comments
 (0)