RedN4ks opened a new pull request, #21488:
URL: https://github.com/apache/kafka/pull/21488

   This PR introduces support for SSL hot reload in the Kafka client.
   
   This feature has been requested since 2020 in KAFKA-10731
   
   It is also related to[ 
KIP-1119](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1119%3A+Add+support+for+SSL+auto+reload):
 Add support for SSL auto reload.
   
   Since this change touches the public API, the KIP should be updated to 
reflect the new configuration parameters introduced in this PR. I do not 
currently have the required permissions to update the KIP on Jira.
   
   ## New Configuration Properties
   
   - `ssl.hotreload.enable`
   Enables or disables the hot reload mechanism.
   Default: false (to preserve backward compatibility).
   - `ssl.hotreload.poll.interval.seconds`
   Polling interval in seconds used to detect material changes.
   Default: 60.
   
   ## Design and Implementation
   
   Unlike @CefBoud work in #17987, which relied on WatchService, this 
implementation uses a polling-based mechanism.
   
   While WatchService is conceptually more elegant, testing revealed that it 
does not work reliably when SSL files are mounted via Kubernetes volumes. After 
building a client JAR and validating the behavior in a Kubernetes environment, 
the watcher-based approach failed to detect file changes. The following article 
explains the underlying issue:
   https://blog.arkey.fr/2019/09/13/watchservice-and-bind-mount/
   
   Given these limitations, I implemented a dedicated SslMaterialPoller class 
responsible for periodically checking SSL material changes using a configurable 
polling interval.
   
   ### Instance Lifecycle
   - Exactly one SslMaterialPoller instance is created per SslFactory instance.
   - At this stage, the poller is not implemented as a singleton. If it is 
guaranteed that only one SslFactory instance exists per client, this could be 
refactored so that SslMaterialPoller becomes a singleton. What's your opinion 
on that?
   
   ## Testing
   The following test scenarios were implemented :
   - `testFileChangeTriggersReconfigure` verifies that modifying SSL material 
triggers a reconfiguration.
   - `testNoReloadWhenHotReloadDisabled` verifies no reload occurs when the 
feature is disabled.
   - `testNoReloadIfFileUnchanged `verifies that no reconfiguration is 
triggered if files remain unchanged.
   - `testMultipleFactoriesIsolatedReload `ensures that multiple SslFactory 
instances handle reload independently without interfering with each other.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to