Skip to content

Conversation

@tinaselenge
Copy link
Contributor

Type of change

Select the type of your PR

  • Refactoring

Description

Remove the custom properties that are in IGNORABLE_PROPERTIES as they get skipped using KafkaConfiguration.isCustomConfigurationOption() anyway.

The debug logs for the configuration difference include the properties that are ignorable or custom even though they are not included in the final update. The current and desired values for these properties are always different as they contain placeholders or are custom, which results in logging them all the time:

2025-10-21 08:55:12 DEBUG KafkaBrokerConfigurationDiff:183 - Reconciliation #1(watch) Kafka(namespace-0/cluster-ebf06a3a): Kafka Broker 0 Config Differs : {"op":"replace","path":"/config.providers.strimzifile.param.allowed.paths","value":"/opt/kafka"}
2025-10-21 08:55:12 DEBUG KafkaBrokerConfigurationDiff:184 - Reconciliation #1(watch) Kafka(namespace-0/cluster-ebf06a3a): Current Kafka Broker Config path config.providers.strimzifile.param.allowed.paths has value "null"
2025-10-21 08:55:12 DEBUG KafkaBrokerConfigurationDiff:185 - Reconciliation #1(watch) Kafka(namespace-0/cluster-ebf06a3a): Desired Kafka Broker Config path config.providers.strimzifile.param.allowed.paths has value "/opt/kafka"
(repeated for all the config providers)
...
2025-10-21 08:55:12 DEBUG KafkaBrokerConfigurationDiff:183 - Reconciliation #1(watch) Kafka(namespace-0/cluster-ebf06a3a): Kafka Broker 0 Config Differs : {"op":"replace","path":"/listener.name.tls-9093.ssl.keystore.key","value":"${strimzisecrets:namespace-0/cluster-ebf06a3a-b-3b9ba644-0:cluster-ebf06a3a-b-3b9ba644-0.key}"}
2025-10-21 08:55:12 DEBUG KafkaBrokerConfigurationDiff:184 - Reconciliation #1(watch) Kafka(namespace-0/cluster-ebf06a3a): Current Kafka Broker Config path listener.name.tls-9093.ssl.keystore.key has value "null"
2025-10-21 08:55:12 DEBUG KafkaBrokerConfigurationDiff:185 - Reconciliation #1(watch) Kafka(namespace-0/cluster-ebf06a3a): Desired Kafka Broker Config path listener.name.tls-9093.ssl.keystore.key has value "${strimzisecrets:namespace-0/cluster-ebf06a3a-b-3b9ba644-0:cluster-ebf06a3a-b-3b9ba644-0.key}"
(repeated for all the listener ssl properties)

But these get skipped from the update since they are ignorable or custom.

This PR changes the condition of the logs so that properties with different desired and current values get logged only if they are not ignored or not custom, in another word, if it is a property we intend to update. So it would look like this:

2025-10-21 10:32:55 DEBUG KafkaBrokerConfigurationDiff:175 - Reconciliation #11(watch) Kafka(namespace-0/cluster-ebf06a3a): Kafka Broker 0 Config Differs : {"op":"replace","path":"/min.insync.replicas","value":"1"}
2025-10-21 10:32:55 DEBUG KafkaBrokerConfigurationDiff:176 - Reconciliation #11(watch) Kafka(namespace-0/cluster-ebf06a3a): Current Kafka Broker Config path min.insync.replicas has value "2"
2025-10-21 10:32:55 DEBUG KafkaBrokerConfigurationDiff:177 - Reconciliation #11(watch) Kafka(namespace-0/cluster-ebf06a3a): Desired Kafka Broker Config path min.insync.replicas has value "1"
2025-10-21 10:32:55 DEBUG KafkaRoller:615 - Reconciliation #11(watch) Kafka(namespace-0/cluster-ebf06a3a): Pod cluster-ebf06a3a-b-3b9ba644-0/0 needs to be reconfigured.
2025-10-21 10:32:55 DEBUG KafkaRoller:654 - Reconciliation #11(watch) Kafka(namespace-0/cluster-ebf06a3a): Updating broker configuration cluster-ebf06a3a-b-3b9ba644-0/0
2025-10-21 10:32:56 INFO  KafkaRoller:673 - Reconciliation #11(watch) Kafka(namespace-0/cluster-ebf06a3a): Dynamic update of pod cluster-ebf06a3a-b-3b9ba644-0/0 was successful.

The logs will no longer include ignorable or custom properties.

Checklist

Please go through this checklist and make sure all applicable tasks have been done

  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Check RBAC rights for Kubernetes / OpenShift roles
  • 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
  • Supply screenshots for visual changes, such as Grafana dashboards

@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.81%. Comparing base (005d1a1) to head (d994b85).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...perator/resource/KafkaBrokerConfigurationDiff.java 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12054      +/-   ##
============================================
- Coverage     74.91%   74.81%   -0.10%     
- Complexity     6454     6618     +164     
============================================
  Files           343      376      +33     
  Lines         24336    25329     +993     
  Branches       3207     3390     +183     
============================================
+ Hits          18231    18950     +719     
- Misses         4832     4992     +160     
- Partials       1273     1387     +114     
Files with missing lines Coverage Δ
...perator/resource/KafkaBrokerConfigurationDiff.java 91.86% <94.44%> (+0.39%) ⬆️

... and 38 files with indirect coverage changes

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

LOGGER.traceCr(reconciliation, "Current Kafka Broker Config path {} has value {}", pathValueWithoutSlash, lookupPath(source, pathValue));
LOGGER.traceCr(reconciliation, "Desired Kafka Broker Config path {} has value {}", pathValueWithoutSlash, lookupPath(target, pathValue));
} else {
LOGGER.debugCr(reconciliation, "Kafka Broker {} Config Differs : {}", brokerNodeRef.nodeId(), d);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The alternative is to move these logs into removeProperty and updateOrAdd methods providing all the necessary parameters.

Comment on lines +171 to +173
LOGGER.traceCr(reconciliation, "Kafka Broker {} Config Differs : {}", brokerNodeRef.nodeId(), d);
LOGGER.traceCr(reconciliation, "Current Kafka Broker Config path {} has value {}", pathValueWithoutSlash, lookupPath(source, pathValue));
LOGGER.traceCr(reconciliation, "Desired Kafka Broker Config path {} has value {}", pathValueWithoutSlash, lookupPath(target, pathValue));
Copy link
Member

Choose a reason for hiding this comment

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

So, with this improvement, can we now move these back to debug? They are on trace because there were too many default values. But if they should be filtered out now, maybe we can make the actual removes more visible?

@tinaselenge tinaselenge marked this pull request as ready for review October 24, 2025 12:14
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.

2 participants