Skip to content

Commit

Permalink
[bitnami/kafka] #25646 Use parameter map for kafka config
Browse files Browse the repository at this point in the history
Allow to use a yaml parameter map next to the flat file for the
extraConfig parameter. This is added as a separate parameter
extraConfigYaml. This allows for easier overloading both between
the default and broker / controller values; and between multiple
values.yaml.

Signed-off-by: Ruben Van Wanzeele <[email protected]>
  • Loading branch information
rubenvw-ngdata committed May 30, 2024
1 parent ffe032e commit e3efb1e
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bitnami/kafka/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 29.2.0 (2024-05-30)

* [bitnami/kafka] Add support for helm parameter maps for kafka config, closes ([#25646](https://github.com/bitnami/charts/issues/25646))

## 29.1.2 (2024-05-29)

* [bitnami/kafka] PDB review ([#25938](https://github.com/bitnami/charts/pull/25938))
Expand Down
2 changes: 1 addition & 1 deletion bitnami/kafka/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ maintainers:
name: kafka
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/kafka
version: 29.1.2
version: 29.2.0
3 changes: 3 additions & 0 deletions bitnami/kafka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ You can enable this initContainer by setting `volumePermissions.enabled` to `tru
| `config` | Configuration file for Kafka, rendered as a template. Auto-generated based on chart values when not specified. | `""` |
| `existingConfigmap` | ConfigMap with Kafka Configuration | `""` |
| `extraConfig` | Additional configuration to be appended at the end of the generated Kafka configuration file. | `""` |
| `extraConfigYaml` | Additional configuration in yaml format to be appended at the end of the generated Kafka configuration file. | `{}` |
| `secretConfig` | Additional configuration to be appended at the end of the generated Kafka configuration file. | `""` |
| `existingSecretConfig` | Secret with additonal configuration that will be appended to the end of the generated Kafka configuration file | `""` |
| `log4j` | An optional log4j.properties file to overwrite the default of the Kafka brokers | `""` |
Expand Down Expand Up @@ -551,6 +552,7 @@ You can enable this initContainer by setting `volumePermissions.enabled` to `tru
| `controller.config` | Configuration file for Kafka controller-eligible nodes, rendered as a template. Auto-generated based on chart values when not specified. | `""` |
| `controller.existingConfigmap` | ConfigMap with Kafka Configuration for controller-eligible nodes. | `""` |
| `controller.extraConfig` | Additional configuration to be appended at the end of the generated Kafka controller-eligible nodes configuration file. | `""` |
| `controller.extraConfigYaml` | Additional configuration in yaml format to be appended at the end of the generated Kafka controller-eligible nodes configuration file. | `{}` |
| `controller.secretConfig` | Additional configuration to be appended at the end of the generated Kafka controller-eligible nodes configuration file. | `""` |
| `controller.existingSecretConfig` | Secret with additonal configuration that will be appended to the end of the generated Kafka controller-eligible nodes configuration file | `""` |
| `controller.heapOpts` | Kafka Java Heap size for controller-eligible nodes | `-Xmx1024m -Xms1024m` |
Expand Down Expand Up @@ -675,6 +677,7 @@ You can enable this initContainer by setting `volumePermissions.enabled` to `tru
| `broker.config` | Configuration file for Kafka broker-only nodes, rendered as a template. Auto-generated based on chart values when not specified. | `""` |
| `broker.existingConfigmap` | ConfigMap with Kafka Configuration for broker-only nodes. | `""` |
| `broker.extraConfig` | Additional configuration to be appended at the end of the generated Kafka broker-only nodes configuration file. | `""` |
| `broker.extraConfigYaml` | Additional configuration in yaml format to be appended at the end of the generated Kafka broker-only nodes configuration file. | `{}` |
| `broker.secretConfig` | Additional configuration to be appended at the end of the generated Kafka broker-only nodes configuration file. | `""` |
| `broker.existingSecretConfig` | Secret with additonal configuration that will be appended to the end of the generated Kafka broker-only nodes configuration file | `""` |
| `broker.heapOpts` | Kafka Java Heap size for broker-only nodes | `-Xmx1024m -Xms1024m` |
Expand Down
7 changes: 7 additions & 0 deletions bitnami/kafka/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1219,3 +1219,10 @@ kafka: Missing KRaft or Zookeeper mode settings
Please configure 'kraft.enabled', 'zookeeper.enabled' or `externalZookeeper.servers` before proceeding.
{{- end -}}
{{- end -}}

{{/* Render key, value as proprties format */}}
{{- define "kafka.properties.render" -}}
{{- range $key, $value := . }}
{{ $key }}={{ tpl (toString $value) $ }}
{{- end -}}
{{- end -}}
5 changes: 5 additions & 0 deletions bitnami/kafka/templates/broker/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ data:
log.dir={{ printf "%s/data" .Values.broker.persistence.mountPath }}
# Kafka application logs directory
logs.dir={{ .Values.broker.logPersistence.mountPath }}
# Common Kafka Configuration
{{- include "kafka.commonConfig" . | nindent 4 }}
# Custom Kafka Configuration
{{- include "common.tplvalues.render" ( dict "value" .Values.extraConfig "context" $ ) | nindent 4 }}
{{- include "common.tplvalues.render" ( dict "value" .Values.broker.extraConfig "context" $ ) | nindent 4 }}
{{- include "kafka.properties.render" (merge .Values.broker.extraConfigYaml .Values.extraConfigYaml ) | nindent 4 }}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions bitnami/kafka/templates/controller-eligible/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ data:
log.dir={{ printf "%s/data" .Values.controller.persistence.mountPath }}
# Kafka application logs directory
logs.dir={{ .Values.controller.logPersistence.mountPath }}
# Common Kafka Configuration
{{- include "kafka.commonConfig" . | nindent 4 }}
# Custom Kafka Configuration
{{- include "common.tplvalues.render" ( dict "value" .Values.extraConfig "context" $ ) | nindent 4 }}
{{- include "common.tplvalues.render" ( dict "value" .Values.controller.extraConfig "context" $ ) | nindent 4 }}
{{- include "kafka.properties.render" (merge .Values.controller.extraConfigYaml .Values.extraConfigYaml) | nindent 4 }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions bitnami/kafka/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ existingConfigmap: ""
## @param extraConfig Additional configuration to be appended at the end of the generated Kafka configuration file.
##
extraConfig: ""
## @param extraConfigYaml Additional configuration in yaml format to be appended at the end of the generated Kafka configuration file.
##
## E.g.
## extraConfigYaml:
## default.replication.factor: 3
##
extraConfigYaml: {}
## @param secretConfig Additional configuration to be appended at the end of the generated Kafka configuration file.
## This value will be stored in a secret.
##
Expand Down Expand Up @@ -499,6 +506,10 @@ controller:
## @param controller.extraConfig Additional configuration to be appended at the end of the generated Kafka controller-eligible nodes configuration file.
##
extraConfig: ""
## @param controller.extraConfigYaml Additional configuration in yaml format to be appended at the end of the generated Kafka controller-eligible nodes configuration file.
## If keys of extraConfigYaml are duplicated here, the value from controller.extraConfigYaml is taken.
##
extraConfigYaml: {}
## @param controller.secretConfig Additional configuration to be appended at the end of the generated Kafka controller-eligible nodes configuration file.
## This value will be stored in a secret.
##
Expand Down Expand Up @@ -953,6 +964,10 @@ broker:
## @param broker.extraConfig Additional configuration to be appended at the end of the generated Kafka broker-only nodes configuration file.
##
extraConfig: ""
## @param broker.extraConfigYaml Additional configuration in yaml format to be appended at the end of the generated Kafka broker-only nodes configuration file.
## If keys of extraConfigYaml are duplicated here, the value from broker.extraConfigYaml is taken.
##
extraConfigYaml: {}
## @param broker.secretConfig Additional configuration to be appended at the end of the generated Kafka broker-only nodes configuration file.
## This value will be stored in a secret.
##
Expand Down

0 comments on commit e3efb1e

Please sign in to comment.