Skip to content

Follow SSL bundle reloads in Kafka clients - #52257

Open
annitya wants to merge 1 commit into
spring-projects:mainfrom
annitya:kafka-ssl-live-bundle
Open

annitya wants to merge 1 commit into
spring-projects:mainfrom
annitya:kafka-ssl-live-bundle

Conversation

@annitya

@annitya annitya commented Oct 16, 2026

Copy link
Copy Markdown

Kafka captures the SslBundle instance once, in
SslBundleSslEngineFactory.configure(), and never asks for it again. DefaultSslBundleRegistry replaces the instance registered for a name when the bundle is reloaded, so a client configured at startup keeps presenting the key material it was given then. Rotated certificates only take effect after a restart.

PropertiesKafkaConnectionDetails now adapts each configured bundle name to a LiveSslBundle, which resolves the currently registered bundle on every access instead of capturing it. The reference Kafka holds can no longer go stale, and the next connection uses the latest key material. Established connections are left alone.

Bundles are cached per name so that repeated lookups return the same instance, leaving SslBundleSslEngineFactory.shouldBeRebuilt unaffected, and so that exactly one update handler is registered per bundle. Registering that handler also validates the name, so an unknown bundle keeps failing at startup rather than on first connection.

Kafka captures the SslBundle instance once, in
SslBundleSslEngineFactory.configure(), and never asks for it again.
DefaultSslBundleRegistry replaces the instance registered for a name
when the bundle is reloaded, so a client configured at startup keeps
presenting the key material it was given then. Rotated certificates
only take effect after a restart.

PropertiesKafkaConnectionDetails now adapts each configured bundle
name to a LiveSslBundle, which resolves the currently registered
bundle on every access instead of capturing it. The reference Kafka
holds can no longer go stale, and the next connection uses the latest
key material. Established connections are left alone.

Bundles are cached per name so that repeated lookups return the same
instance, leaving SslBundleSslEngineFactory.shouldBeRebuilt
unaffected, and so that exactly one update handler is registered per
bundle. Registering that handler also validates the name, so an
unknown bundle keeps failing at startup rather than on first
connection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Henning Kvinnesland <henning.kvinnesland@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 16, 2026

This branch has not been deployed

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

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants