Block options and not prefixes in Kafka Connector configs #10503
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Currently, we use forbidden prefixes to block users from setting various configurations managed directly by the Strimzi Cluster Operator. When a user configures any option starting with the prefix (apart from the defined exceptions), the option will be ignored and removed from the config. This worked fine so far for most operands which have mostly a static set of configuration options.
But it does not work well for Kafka Connectors. In Kafka Connectors, we block three options:
name
,connector.class
, andtasks.max
. These are all important options to block as they would cause errors if they were set by users (especially thename
option). But in Kafka Connectors, each connector has different configuration options. And therefore the likelihood of a conflict when blocking the whole prefix is not impossible, especially with a generic option such asname
. #10500 describes one such conflict.This PR improves how we handle the forbidden prefixes. It keeps the original logic, but it also adds support for forbidden options to the
AbstractConfiguration
. That allows us to keep the existing logic where it suits (for example blocking whole range of security-related options). But it allows to also block individual options such as those in Kafka Connectors instead of treating them as prefixes. That allows us to use options such asnamespace.mapper
while blocking the optionname
I considered some other alternatives as well. For example
But the approach used in the PR (and described above) seemed best to me.
Apart from the actual fix, this PR also cleans up the various methods in
AbstractConfiguration
. It keeps only 3 constructors (one copy constructor and two regular ones) and makes it much easier to test this class as there are only two execution paths and not 8 of them.This should resolve #10500.
Checklist