Skip to content

Enable dynamic configuration of Metrics Reporter's allowlist#12576

Open
im-konge wants to merge 3 commits intostrimzi:mainfrom
im-konge:metrics-reporter-dynamic-update
Open

Enable dynamic configuration of Metrics Reporter's allowlist#12576
im-konge wants to merge 3 commits intostrimzi:mainfrom
im-konge:metrics-reporter-dynamic-update

Conversation

@im-konge
Copy link
Copy Markdown
Member

@im-konge im-konge commented Mar 27, 2026

Type of change

  • Enhancement / new feature

Description

This PR adds prometheus.metrics.reporter.allowlist to the config-models, so we are able to change this configuration dynamically by configuring the allowList field inside the Kafka CR.
This configuration is forbidden in case that it is configured inside the spec.kafka.config, however we are able to do the dynamic update using the allowList - as the code goes through the configuration, checks if the particular config is inside config-model and if yes and it's not READ_ONLY, it performs the dynamic update.

So the only thing needed was to add this configuration to the config-models.
I tried also adding "custom-config-model" with special handling (commit d2c72f5), but FMPOV it was a lot of changes given the same result as updating the config-model-generator

Fixes #12400

Checklist

  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
  • Reference relevant issue(s) and close them after merging
  • Update CHANGELOG.md

@im-konge im-konge added this to the 1.0.0 milestone Mar 27, 2026
@im-konge im-konge self-assigned this Mar 27, 2026
@im-konge im-konge force-pushed the metrics-reporter-dynamic-update branch from 4aa49a7 to bbadea8 Compare March 27, 2026 15:54
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.02%. Comparing base (1a0c0e1) to head (4f72050).

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12576      +/-   ##
============================================
+ Coverage     75.00%   75.02%   +0.02%     
- Complexity     6434     6436       +2     
============================================
  Files           373      373              
  Lines         24881    24881              
  Branches       3205     3205              
============================================
+ Hits          18663    18668       +5     
+ Misses         4902     4899       -3     
+ Partials       1316     1314       -2     

see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Lukas Kral <lukywill16@gmail.com>
Signed-off-by: Lukas Kral <lukywill16@gmail.com>
Signed-off-by: Lukas Kral <lukywill16@gmail.com>
@im-konge im-konge force-pushed the metrics-reporter-dynamic-update branch from a4e539c to 4f72050 Compare March 27, 2026 21:36
@im-konge im-konge marked this pull request as ready for review March 27, 2026 21:37
@im-konge im-konge requested review from a team and mimaison March 27, 2026 21:42
@scholzj scholzj requested a review from tinaselenge March 28, 2026 21:50
Copy link
Copy Markdown
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if having it in the models is the right way forward (and if yes, should we have some tests?). Do we expect it to differ per Kafka version? Or should we instead have for example a separate checks in the config diff instead?

@im-konge
Copy link
Copy Markdown
Member Author

I wonder if having it in the models is the right way forward (and if yes, should we have some tests?). Do we expect it to differ per Kafka version? Or should we instead have for example a separate checks in the config diff instead?

As I mentioned in the description, I also added this custom config model, which looked to me to be too much complicated and "extra". I picked the way of having it in the config models as it is the simplest solution, the plugin is added to every Kafka version that particular Strimzi version supports. I was thinking about also how to handle more config options in the future and this was the best solution which came to my mind. Also, given the number of checks if the particular config is rollable (if it's not READ_ONLY or PER_BROKER etc.), this was the ideal solution.
But I'm open to other ideas.

@im-konge
Copy link
Copy Markdown
Member Author

And yes, I wanted to add some UTs for the config-model-generator, but I wanted to know if you think this is the right way (or if someone else will come up with better idea)

@im-konge
Copy link
Copy Markdown
Member Author

@strimzi/maintainers once you have time, it would be useful for me to see if there is any other path to pick, I had the custom config model path implemented, I was checking if we can change just code to handle it (however it was more changes and maybe it wasn't the best thing for the future) and then this. Thanks

@scholzj
Copy link
Copy Markdown
Member

scholzj commented Mar 30, 2026

I'm not sure I would go with a custom JSON model. I wonder more if this can be handled when diffing the configuration directly.

@im-konge
Copy link
Copy Markdown
Member Author

I'm not sure I would go with a custom JSON model. I wonder more if this can be handled when diffing the configuration directly.

That's what I tried - the difference (and the context if the Pod has older revision and should be rolled or should be just dynamically updated) is checked against the config model and yes, you can add some other checks or "workaround". I was just thinking about situations when you want to change the scope (PER_BROKER or CLUSTER_WIDE) for each configuration, having it handled in the code (like containing some map or something) is fine, but by adding it to the config model you will actually remove another set of code and the different branches of the code you will have to add there (which needs to be tested). In the config model we can just have tests that these custom configs are present and we can configure the scope.

Or do you think about different kind of path?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Dynamic configuration updates in Strimzi Metrics Reporter 0.3.0

2 participants