Skip to content

Add TLS support for StrimziKafkaCLuster #193

Open
see-quick wants to merge 7 commits intostrimzi:mainfrom
see-quick:tls-enchancement
Open

Add TLS support for StrimziKafkaCLuster #193
see-quick wants to merge 7 commits intostrimzi:mainfrom
see-quick:tls-enchancement

Conversation

@see-quick
Copy link
Copy Markdown
Member

@see-quick see-quick commented Mar 4, 2026

This PR adds support TLS to StrimziKafkaCluster class and exposing it via public API:

StrimziKafkaCluster kafkaCluster = new StrimziKafkaCluster.StrimziKafkaClusterBuilder()
    .withNumberOfBrokers(3)
    .withTls()
    .build();

It adds a internal classes (i.e., Keytool, CertAssembly). Keytool is fluent wrapper for operations executed inside container and CertAssembly orchestrates all certificates work and all operations is delegated to Keytool.

Note

Because the SANs include the broker network aliases (broker-0, broker-1, ...), the advertised listeners use these DNS > names instead of dynamic container IPs.

Moreover during implementation I tried to make as little as possible and so I would change some of the parts in the next PRs (refactors) but those parts are not related to TLS functionality at all for instance #192.

@see-quick see-quick added this to the 0.116.0 milestone Mar 4, 2026
@see-quick see-quick requested a review from a team March 4, 2026 12:29
@see-quick see-quick self-assigned this Mar 4, 2026
@see-quick see-quick added the enhancement New feature or request label Mar 4, 2026
@see-quick
Copy link
Copy Markdown
Member Author

^^ take a look @strimzi/maintainers thanks :)

* client certs during mTLS), while the client truststore
* contains the cluster CA (to verify the broker's identity).
*
* Manages three pairs of PKCS12 stores:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In Strimzi cluster-operator we have been moving away from PKCS12 stores to using PEM files, is it worth doing the same here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wonder if it's worth doing ... as main purpose of this is for testing test-clients and the bridge repo. Moreover the Keytool natively generates to PKCS12. I didn't want to use OpenSSL here as it seems an overkill for such use case. Also I know more Keytool than OpenSSL so that was more like personal preference.

I think that currently Keytool cannot export private keys in the PEM format so that would need openssl so I am not sure I want this hybrid-approach or doing all steps only with OpenSSL.

But if you see a way that it would be beneficial to also test in operator repo when we would use PEM files I am open to change...

Signed-off-by: see-quick <maros.orsak159@gmail.com>

# Conflicts:
#	src/test/java/io/strimzi/test/container/StrimziKafkaContainerMockTest.java
Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
…outbound raft connections to controllers)

Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants