[feat][misc] PIP-478: dedicated pulsar-tls-factory-api and pulsar-http-client-api SPI modules#26222
Open
lhotari wants to merge 1 commit into
Open
[feat][misc] PIP-478: dedicated pulsar-tls-factory-api and pulsar-http-client-api SPI modules#26222lhotari wants to merge 1 commit into
lhotari wants to merge 1 commit into
Conversation
…p-client-api SPI modules ### Motivation This is the first implementation PR for [PIP-478](apache#25890) (design doc). It introduces the two small, dependency-light SPI modules the rest of the PIP builds on, with no behavioural change to any existing module — nothing consumes them yet. - `pulsar-tls-factory-api` — the purpose-driven `PulsarTlsFactory` TLS SPI that replaces PIP-337: a factory is asked only for a ready-built TLS object for a given `TlsPurpose`, with rotation confined to a reload callback (rebuild-not-mutate) and key material never crossing a Pulsar API. The flat `TlsPolicy` value type carries cert/key/trust material, ciphers/protocols, hostname verification, and three orthogonal provider axes — the TLS engine, the JSSE (`SSLContext`) provider (`jsseProvider`), and the JCA crypto provider that parses key material (`jcaProvider`). - `pulsar-http-client-api` — the framework-managed `PulsarHttpClient` SPI so auth plugins share the client's HTTP runtime (event loops, timers, DNS, TLS refresh) instead of spinning up private `AsyncHttpClient` instances. They live in their own modules so the sibling broker-side PIP can depend on them without importing a client artifact. ### Modifications - New module `pulsar-tls-factory-api`: `PulsarTlsFactory`, `TlsPolicy`, `TlsPurpose`, `TlsFactoryInitContext`, `TlsHandle`, `TlsEndpoint`. - New module `pulsar-http-client-api` (depends on the former): `PulsarHttpClient`, `PulsarHttpClientFactory`, `PulsarHttpClientConfig`, `HttpRequest`, `HttpResponse`. - Build wiring: `settings.gradle.kts`, `pulsar-bom`, the `pulsar-common` test dependency on the SPI types, and the binary-license check. - Unit tests for `TlsPolicy` validation and `TlsPurpose`. Assisted-by: Claude Opus 4.8 (Claude Code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PIP: #25890
Motivation
This is the first implementation PR for PIP-478. The implementation is split into a series of PRs submitted one at a time; this one lands only the foundation the rest of the PIP builds on: two small, dependency-light SPI modules. Nothing consumes them yet, so there is no behavioural change to any existing module.
pulsar-tls-factory-api— the purpose-drivenPulsarTlsFactoryTLS SPI that replaces PIP-337. A factory is asked only for a ready-built TLS object for a givenTlsPurpose, with rotation confined to a reload callback (rebuild-not-mutate) and key material never crossing a Pulsar API — so KMS/HSM and workload-identity integrations become first-class instead of requiring a fork of the SSL layer. The flatTlsPolicyvalue type carries cert/key/trust material (PEM or keystore), ciphers/protocols, hostname verification, and three orthogonal provider axes: the TLS engine (JDK vs native OpenSSL), the JSSE (SSLContext) provider (jsseProvider), and the JCA crypto provider that parses key material (jcaProvider).pulsar-http-client-api— the framework-managedPulsarHttpClientSPI, so authentication plugins share the client's HTTP runtime (event loops, timers, DNS caches, TLS-material refresh) instead of spinning up privateAsyncHttpClientinstances.They live in their own modules — rather than inside a client artifact — so the sibling broker-side PIP can depend on them without importing a client jar.
Modifications
pulsar-tls-factory-api:PulsarTlsFactory,TlsPolicy,TlsPurpose,TlsFactoryInitContext,TlsHandle,TlsEndpoint.pulsar-http-client-api(depends on the former):PulsarHttpClient,PulsarHttpClientFactory,PulsarHttpClientConfig,HttpRequest,HttpResponse.settings.gradle.kts,pulsar-bom, thepulsar-commontest dependency on the SPI types, and the binary-license check.TlsPolicyvalidation andTlsPurpose.Both modules compile standalone against
master; no existing code references them.Verifying this change
This change added tests and can be verified as follows:
TlsPolicyValidationTest—TlsPolicybuilder validation (PEM vs keystore, required fields).TlsPurposeTest—TlsPurposeidentity, role, and equality.checkstandalone (./gradlew :pulsar-tls-factory-api:build :pulsar-http-client-api:build), and./gradlew quickCheck(license headers + checkstyle) passes over the tree.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
settings.gradle.ktsandpulsar-bom; no third-party dependencies added.org.apache.pulsar.tlsandorg.apache.pulsar.httpSPI packages as new public API. They are additive and unreferenced by existing code in this PR.Documentation
doc-requireddoc-not-needed— SPI modules with no user-facing surface yet; the PIP-478 design document ([feat][pip] PIP-478: Asynchronous v5 client auth plugin interfaces and TLS material provider plugin interface #25890) covers the design.docdoc-completeMatching PR in forked repository
PR in forked repository: lhotari/pulsar (Personal CI)
This PR was prepared with the assistance of Claude Code (Opus 4.8); the change was reviewed and is submitted by a human contributor who takes responsibility for it, per the ASF Generative Tooling guidance.