Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for apache\kafka docker image #178

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

milenkovicm
Copy link
Contributor

@milenkovicm milenkovicm commented Aug 12, 2024

Up till now kafka test container used confluentinc/cp-kafka, recently kafka started producing two official
images apache\kafka and apache\kafka-native which may use kraft protocol, thus no zookeeper
instance is needed.

apache\kafka-native image has kafka server compiled using GraalVM which decreases container startup and memory consumption.

Default image is apache\kafka-native which provide fast starting speed.

More details:

@milenkovicm milenkovicm changed the title feat: Add support for apache\kafka docker image feat: add support for apache\kafka docker image Aug 12, 2024
src/lib.rs Outdated Show resolved Hide resolved
src/kafka_native/mod.rs Outdated Show resolved Hide resolved
@milenkovicm
Copy link
Contributor Author

I've used this commit to fix mongo example missing feature which was failing tests

Copy link
Contributor

@DDtKey DDtKey left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution 🙏

src/kafka/apache.rs Outdated Show resolved Hide resolved
src/kafka/apache.rs Outdated Show resolved Hide resolved
CommanderStorm

This comment was marked as resolved.

@milenkovicm milenkovicm force-pushed the kafka_native branch 2 times, most recently from ce75611 to 1d2d0af Compare August 21, 2024 09:02
@milenkovicm
Copy link
Contributor Author

thanks @CommanderStorm, I hope your comments have been addressed

Up till now kafka test container used `confluentinc/cp-kafka`,
recently kafka started producing two official
images `apache\kafka` and `apache\kafka-native`
which may use `kraft` protocol, thus no zookeeper
instance is needed

This commit exposes test container which utilizes
those new containers, with `kraft` protocol enabled.

Default image is `apache\kafka-native` which provide
fast starting speed, low memory utilization and
smaller docker image.

More details:

- [KIP-974: Docker Image for GraalVM based Native Kafka Broker](https://cwiki.apache.org/confluence/display/KAFKA/KIP-974%3A+Docker+Image+for+GraalVM+based+Native+Kafka+Broker)
- [KIP-975: Docker Image for Apache Kafka](https://cwiki.apache.org/confluence/display/KAFKA/KIP-975%3A+Docker+Image+for+Apache+Kafka)
- [Java testcontainer implementation](https://github.com/testcontainers/testcontainers-java/blob/1.20.1/modules/kafka/src/main/java/org/testcontainers/kafka/KafkaContainer.java#)
CommanderStorm

This comment was marked as resolved.

DDtKey pushed a commit that referenced this pull request Aug 21, 2024
I noticed that there currently is not LDAP testcontainer.

Similar to the [go testontainer
modules](https://github.com/testcontainers/testcontainers-go/blob/c44b1b2ed935455fa222f122a7474efe309f641c/modules/openldap/openldap.go#L128C19-L128C41),
I chose the
[`bitnami/openldap`](https://github.com/bitnami/containers/blob/main/bitnami/openldap/README.md)
containers.

Similar to
#178,
this PR includes the mongodb-example-fix.

const KAFKA_NATIVE_IMAGE_NAME: &str = "apache/kafka-native";
const KAFKA_IMAGE_NAME: &str = "apache/kafka";
const TAG: &str = "latest";
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, missed that part.
We do not use the latest version because it does not guarantee image stability. Users can always override it to the latest version if they want, but this easily leads to instability and the implementation can quickly become outdated.

Copy link
Contributor

Choose a reason for hiding this comment

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

UPD: I've updated this to use 3.8.0 to speed up the PR readiness. Going to merge soon

src/kafka/apache.rs Outdated Show resolved Hide resolved
@DDtKey DDtKey merged commit 31a5a8e into testcontainers:main Aug 22, 2024
5 of 6 checks passed
@github-actions github-actions bot mentioned this pull request Aug 31, 2024
DDtKey pushed a commit that referenced this pull request Aug 31, 2024
## 🤖 New release
* `testcontainers-modules`: 0.9.0 -> 0.10.0

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.10.0] - 2024-08-31

### Bug Fixes

- Doc-test failures
([#186](#186))

### Documentation

- Added docs for Apache ZooKeeper
([#184](#184))
- Documented all ports which containers at least expose
([#183](#183))
- Enable `rustfmt` for doc comments
([#187](#187))
- Fixed rustfmt violation in the `openldap` module
([#189](#189))
- Fixed a bit of missing docs in the openldap module
([#191](#191))
- Complete the documentation for the meilisearch module
([#192](#192))
- Complete the `*_PORT` documentation
([#195](#195))
- Add `pub mod` docs
([#193](#193))
- Documents the neo4j plugins
([#194](#194))

### Features

- Added an `OpenLDAP` testcontainer module
([#180](#180))
- Add support for `apache\kafka` docker image
([#178](#178))
- [**breaking**] Update `testcontainers` to 0.22.0
([#203](#203))

### Miscellaneous Tasks

- Changed from `actions-rs` to a more maintained CI alternative
([#188](#188))

### Refactor

- [**breaking**] Changed `KAFKA_PORT` to a `ContainerPort`
([#185](#185))

<!-- generated by git-cliff -->
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants