Skip to content

Conversation

@capistrant
Copy link
Contributor

@capistrant capistrant commented Nov 12, 2025

Description

Some docker runtime setups can struggle to run the Apache Kafka image. Switching to something like Apache kafka-native can work (it works for my apple silicon + colima docker runtime). This change allows using test configurations locally to switch the image without changing source files. It will leave the default to the same image that KafkaResource already uses apache/kafka:4.0.0


Key changed/added classes in this PR
  • KafkaResource

This PR has:

  • been self-reviewed.

@jtuglu1
Copy link
Contributor

jtuglu1 commented Nov 12, 2025

Have a use for this as well – thanks.

Copy link
Contributor

@jtuglu1 jtuglu1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@kfaraz kfaraz left a comment

Choose a reason for hiding this comment

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

Thanks for adding this, @capistrant !
Left a couple of non blocking suggestions.

{
private static final String KAFKA_IMAGE = "apache/kafka:4.0.0";
// Offering an opportunity to override can help some local devs whose system struggles to run apache/kafka. Overriding with apache/kafka-native can help.
private static final String KAFKA_IMAGE = System.getProperty("druid.kafka.test.image", "apache/kafka:4.0.0");
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Should we use the name druid.testing.kafka.image to align with the Druid image property name used in DruidContainerResource?

public class KafkaResource extends TestcontainerResource<KafkaContainer>
{
private static final String KAFKA_IMAGE = "apache/kafka:4.0.0";
// Offering an opportunity to override can help some local devs whose system struggles to run apache/kafka. Overriding with apache/kafka-native can help.
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's convert this to a javadoc.
It would be nice to link it in the class level javadoc too.

Also maybe rephrase to something like:

Suggested change
// Offering an opportunity to override can help some local devs whose system struggles to run apache/kafka. Overriding with apache/kafka-native can help.
/**
* Kafka Docker image used in embedded tests. The image name is
* read from the system property {@code druid.testing.kafka.image} and
* defaults to {@code apache/kafka}. Environments that cannot run that
* image should set the system property to {@code apache/kafka-native}.
*/

@capistrant
Copy link
Contributor Author

Thanks for review @kfaraz @jtuglu1 I updated the name per recommendation and have also improved javadoc comments as suggested. Plan to merge once green CI 👍

@capistrant capistrant merged commit a54c55b into apache:master Nov 13, 2025
110 of 112 checks passed
@kgyrtkirk kgyrtkirk added this to the 36.0.0 milestone Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants