Skip to content

Commit

Permalink
release charts/kafka-ha 16.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
itboon committed Apr 4, 2024
1 parent 6be1260 commit 3378299
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 83 deletions.
2 changes: 1 addition & 1 deletion charts/kafka-ha/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: kafka-ha
description: Helm chart for Apache Kafka.
type: application

version: 15.0.0
version: 16.0.0
appVersion: v3.6.1

maintainers:
Expand Down
35 changes: 0 additions & 35 deletions charts/kafka-ha/templates/_container.tpl

This file was deleted.

7 changes: 7 additions & 0 deletions charts/kafka-ha/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,10 @@ kafka combinedMode
{{- print "false" -}}
{{- end -}}
{{- end -}}

{{/*
kafka clusterDomain
*/}}
{{- define "kafka.clusterDomain" -}}
{{- default "cluster.local" .Values.clusterDomain -}}
{{- end -}}
46 changes: 30 additions & 16 deletions charts/kafka-ha/templates/_kafka-env.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{{/*
KAFKA broker domainSuffix
*/}}
{{- define "kafka.broker.domainSuffix" -}}
{{- $serviceName := include "kafka.broker.headless.serviceName" . -}}
{{- $namespace := .Release.Namespace -}}
{{- $clusterDomain := ( include "kafka.clusterDomain" .) -}}
{{- printf "%s.%s.svc.%s" $serviceName $namespace $clusterDomain -}}
{{- end -}}

{{/*
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS
*/}}
{{- define "kafka.controller.quorum.voters" -}}
{{- $controllerPort := int .Values.containerPort.controller }}
{{- $controllerReplicaCount := int .Values.controller.replicaCount }}
{{- $controllerFullName := include "kafka.controller.fullname" . }}
{{- $serviceName := include "kafka.controller.headless.serviceName" . }}
Expand All @@ -12,10 +21,15 @@ KAFKA_CFG_CONTROLLER_QUORUM_VOTERS
{{- $serviceName = include "kafka.broker.headless.serviceName" . }}
{{- end }}
{{- $namespace := .Release.Namespace -}}
{{- range $i := until $controllerReplicaCount }}
{{- if gt $i 0 }}{{ printf "," }}{{ end }}{{ printf "%d@%s-%d.%s.%s.svc:%d" $i $controllerFullName $i $serviceName $namespace $controllerPort }}
{{- end }}
{{- end }}
{{- $clusterDomain := ( include "kafka.clusterDomain" .) -}}
{{- $port := int .Values.containerPort.controller }}
{{- $suffix := printf "%s.%s.svc.%s:%d" $serviceName $namespace $clusterDomain $port -}}
{{- $servers := list -}}
{{- range $i := until $controllerReplicaCount -}}
{{- $servers = printf "%d@%s-%d.%s" $i $controllerFullName $i $suffix | append $servers -}}
{{- end -}}
{{ join "," $servers }}
{{- end -}}

{{/*
KAFKA Broker Componet label
Expand Down Expand Up @@ -62,7 +76,6 @@ controller env
broker env
*/}}
{{- define "kafka.broker.containerEnv" -}}
{{- $replicaCount := .Values.broker.replicaCount | int -}}
- name: POD_HOST_IP
valueFrom:
fieldRef:
Expand Down Expand Up @@ -90,7 +103,8 @@ broker env
value: "BROKER://0.0.0.0:{{ .Values.containerPort.broker }},EXTERNAL://0.0.0.0:{{ .Values.containerPort.brokerExternal }}"
{{- end }}
- name: KAFKA_CFG_ADVERTISED_LISTENERS
value: "BROKER://$(POD_IP):{{ .Values.containerPort.broker }}"
{{- $domainSuffix := (include "kafka.broker.domainSuffix" .) }}
value: "BROKER://$(POD_NAME).{{ $domainSuffix }}:{{ .Values.containerPort.broker }}"
{{- if .Values.broker.external.enabled }}
- name: KAFKA_EXTERNAL_SERVICE_TYPE
value: {{ .Values.broker.external.service.type | quote }}
Expand All @@ -105,13 +119,14 @@ broker env
value: CONTROLLER
- name: KAFKA_CFG_CONTROLLER_QUORUM_VOTERS
value: {{ include "kafka.controller.quorum.voters" . }}
{{- $replicaCount := .Values.broker.replicaCount | int }}
{{- if and $replicaCount (ge $replicaCount 3) }}
- name: KAFKA_CFG_DEFAULT_REPLICATION_FACTOR
value: "3"
- name: KAFKA_CFG_MIN_INSYNC_REPLICAS
value: "2"
- name: KAFKA_CFG_NUM_PARTITIONS
value: "9"
value: "6"
- name: KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR
value: "3"
- name: KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR
Expand Down Expand Up @@ -179,15 +194,14 @@ kafka fullNodePorts
KAFKA BOOTSTRAPSERVERS
*/}}
{{- define "kafka.bootstrapServers" -}}
{{- $servers := list -}}
{{- $brokerPort := .Values.containerPort.broker | int -}}
{{- $brokerReplicaCount := int .Values.broker.replicaCount -}}
{{- $brokerFullName := include "kafka.broker.fullname" . -}}
{{- $serviceName := include "kafka.broker.headless.serviceName" . -}}
{{- $namespace := .Release.Namespace -}}
{{- range $i := until $brokerReplicaCount -}}
{{- $servers = printf "%s-%d.%s.%s.svc:%d" $brokerFullName $i $serviceName $namespace $brokerPort | append $servers -}}
{{- end -}}
{{- $domainSuffix := (include "kafka.broker.domainSuffix" .) -}}
{{- $brokerPort := .Values.containerPort.broker | int -}}
{{- $servers := list -}}
{{- $brokerReplicaCount := int .Values.broker.replicaCount -}}
{{- range $i := until $brokerReplicaCount -}}
{{- $servers = printf "%s-%d.%s:%d" $brokerFullName $i $domainSuffix $brokerPort | append $servers -}}
{{- end -}}
{{ join "," $servers }}
{{- end -}}

Expand Down
11 changes: 1 addition & 10 deletions charts/kafka-ha/templates/broker/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,10 @@ spec:
{{- end }}
env:
{{- include "kafka.broker.containerEnv" . | nindent 8 }}
#- name: KAFKA_CFG_ADVERTISED_LISTENERS
# value: "foo"
ports:
{{- include "kafka.broker.containerPorts" . | nindent 8 }}
livenessProbe:
exec:
command:
- sh
- -c
- bin/kafka-broker-api-versions.sh --bootstrap-server=127.0.0.1:{{ $brokerPort }}
{{- with $thisValues.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
readinessProbe:
Expand Down Expand Up @@ -132,8 +125,6 @@ spec:
preStop:
exec:
command: ["sh", "-c", "sleep 10; bin/kafka-server-stop.sh"]
initContainers:
{{- include "kafka.initContainer.checkClusterId" . | nindent 8 }}
terminationGracePeriodSeconds: {{ $thisValues.terminationGracePeriodSeconds }}
volumes:
- name: entrypoint-sh
Expand Down
4 changes: 1 addition & 3 deletions charts/kafka-ha/templates/broker/svc-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ metadata:
spec:
type: ClusterIP
clusterIP: None
{{- if .Values.broker.combinedMode.enabled }}
publishNotReadyAddresses: true
{{- end }}
ports:
- port: {{ .Values.broker.service.port }}
targetPort: broker
protocol: TCP
name: broker
{{- if .Values.broker.combinedMode.enabled }}
{{- if (eq (include "kafka.combinedMode" .) "true") }}
- port: {{ .Values.controller.service.port }}
targetPort: controller
protocol: TCP
Expand Down
3 changes: 3 additions & 0 deletions charts/kafka-ha/templates/broker/svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
labels:
{{- include "kafka.labels" . | nindent 4 }}
component: {{ $componet | quote }}
{{- with $svcValues.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $svcValues.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
2 changes: 0 additions & 2 deletions charts/kafka-ha/templates/controller/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ spec:
preStop:
exec:
command: ["sh", "-c", "sleep 10; bin/kafka-server-stop.sh"]
initContainers:
{{- include "kafka.initContainer.checkClusterId" . | nindent 8 }}
terminationGracePeriodSeconds: {{ $thisValues.terminationGracePeriodSeconds }}
volumes:
- name: entrypoint-sh
Expand Down
2 changes: 1 addition & 1 deletion charts/kafka-ha/templates/controller/svc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.broker.combinedMode.enabled }}
{{- if (eq (include "kafka.combinedMode" .) "false") }}
{{- $thisFullName := include "kafka.controller.headless.serviceName" . }}
{{- $componet := "controller" }}
apiVersion: v1
Expand Down
2 changes: 1 addition & 1 deletion charts/kafka-ha/templates/exporter/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
imagePullPolicy: {{ $thisValues.image.pullPolicy }}
ports:
- containerPort: 9308
name: http-metrics
name: {{ $thisValues.containerPortName | default "http-metrics"}}
protocol: TCP
{{- with $thisValues.resources }}
resources:
Expand Down
26 changes: 26 additions & 0 deletions charts/kafka-ha/templates/exporter/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if and .Values.exporter.enabled .Values.exporter.service }}
{{- $svcValues := .Values.exporter.service }}
{{- $componet := "kafka-exporter" }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "kafka.exporter.fullname" . }}
labels:
{{- include "kafka.labels" . | nindent 4 }}
{{- with $svcValues.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $svcValues.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ports:
- name: {{ $svcValues.portName | default "http-metrics" }}
port: {{ $svcValues.port | default 9308 }}
targetPort: {{ .Values.exporter.containerPortName | default "http-metrics" }}
protocol: TCP
selector:
{{- include "kafka.selectorLabels" . | nindent 4 }}
component: {{ $componet | quote }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/kafka-ha/templates/ui/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
name: {{ include "kafka.ui.fullname" . }}
labels:
{{- include "kafka.labels" . | nindent 4 }}
{{- with $svcValues.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $svcValues.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
29 changes: 15 additions & 14 deletions charts/kafka-ha/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

nameOverride: "kafka"
fullnameOverride: ""
clusterDomain: "cluster.local"

# It is recommended to use a random cluster id for each cluster.
# cat /proc/sys/kernel/random/uuid | base64 | cut -b 1-22
Expand Down Expand Up @@ -62,17 +63,13 @@ broker:

## broker.readinessProbe
readinessProbe:
initialDelaySeconds: 25
periodSeconds: 10
initialDelaySeconds: 50
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 3

## broker.livenessProbe
livenessProbe:
initialDelaySeconds: 300
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 5
livenessProbe: {}

## broker.nodeSelector
nodeSelector: {}
Expand Down Expand Up @@ -146,13 +143,13 @@ controller:
failureThreshold: 3

## controller.livenessProbe
livenessProbe:
tcpSocket:
port: controller
initialDelaySeconds: 300
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 5
livenessProbe: {}
# tcpSocket:
# port: controller
# initialDelaySeconds: 300
# periodSeconds: 30
# timeoutSeconds: 5
# failureThreshold: 5

## controller.nodeSelector
nodeSelector: {}
Expand Down Expand Up @@ -196,6 +193,10 @@ exporter:
requests:
cpu: 50m
memory: 128Mi

## exporter.service
service:
annotations: {}

ui:
enabled: false
Expand Down

0 comments on commit 3378299

Please sign in to comment.