Open
Description
Bug Description
When a user defines a Kafka configuration in .spec.kafka.config
that includes a config provider alias with the same name as one automatically created by the operator, the user's alias takes precedence. This occurs because the user's configuration is written after the operator's in the final Kafka config file, effectively overriding the operator-defined alias. As a result, the Kafka configuration may be invalid or behave unexpectedly.
Steps to reproduce
In the following example, a bad user configuration causes all Kafka nodes to crash loop:
$ kubectl get k my-cluster -o yaml | yq '.spec.kafka.config'
...
config.providers: strimzienv
config.providers.strimzienv.class: org.apache.kafka.common.config.provider.EnvVarConfigProvider
config.providers.strimzienv.param.allowlist.pattern: test.*
$ kubectl exec my-cluster-broker-0 -- cat /tmp/strimzi.properties
##########
# Config providers
##########
# Configuration providers configured by the user and by Strimzi
config.providers=strimzienv,strimzienv,strimzifile,strimzidir
config.providers.strimzienv.class=org.apache.kafka.common.config.provider.EnvVarConfigProvider
config.providers.strimzienv.param.allowlist.pattern=.*
config.providers.strimzifile.class=org.apache.kafka.common.config.provider.FileConfigProvider
config.providers.strimzifile.param.allowed.paths=/opt/kafka
config.providers.strimzidir.class=org.apache.kafka.common.config.provider.DirectoryConfigProvider
config.providers.strimzidir.param.allowed.paths=/opt/kafka
##########
# User provided configuration
##########
config.providers.strimzienv.class=org.apache.kafka.common.config.provider.EnvVarConfigProvider
config.providers.strimzienv.param.allowlist.pattern=test.*
Expected behavior
Config providers is a critical configuration for the operator, so any conflicting user configuration should throw an InvalidConfiguration
exception.
Strimzi version
main
Kubernetes version
1.32
Installation method
No response
Infrastructure
No response
Configuration files and logs
No response
Additional context
No response