Skip to content

Commit bcf7812

Browse files
authored
KAFKA-16932: Add documentation for the native docker image (apache#16338)
This PR contains the the following documentation changes for the native docker image: in the docker/README.md: How to build, release and promote the native docker image. in the tests/README.md: How to run system tests by bringing up kafka in the native mode. added docker/native/README.md added html changes for the kafka-site added native docker image support in the docker compose files examples. Testing: Tested all the docker compose files with both the docker images - jvm and native Tested the html changes locally with the kafka-site Reviewers: Manikumar Reddy <[email protected]>, Vedarth Sharma <[email protected]>
1 parent 4e84603 commit bcf7812

File tree

14 files changed

+213
-75
lines changed

14 files changed

+213
-75
lines changed

docker/README.md

+51-12
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ Docker Images
44
Introduction
55
------------
66

7-
This directory contains scripts to build, test, push and promote docker image for kafka. It also contains scripts to build, test the JVM-based Docker Official Image, and generate a PR template for the same to be raised under the Docker official images repo.
8-
All of the steps can be either performed locally or by using Github Actions.
7+
This directory contains:
8+
- Scripts to build, test, push and promote docker images for apache kafka - both `jvm` based and graalvm based `native` kafka
9+
- Scripts to build, test the JVM-based Docker Official Image, and generate a PR template for the same to be raised under the Docker official images repo.
10+
All of the steps can be either performed locally or by using Github Actions.
911

1012
Github Actions
1113
--------------
@@ -27,41 +29,61 @@ Building image and running tests using github actions
2729

2830
- kafka-url - This is the url to download kafka tarball from. For example kafka tarball url from (https://archive.apache.org/dist/kafka). For building RC image this will be an RC tarball url.
2931

30-
- image-type - This is the type of image that we intend to build. This will be dropdown menu type selection in the workflow. `jvm` image type is for official docker image (to be hosted on apache/kafka) as described in [KIP-975](https://cwiki.apache.org/confluence/display/KAFKA/KIP-975%3A+Docker+Image+for+Apache+Kafka)
32+
- image-type - This is the type of image that we intend to build. This will be dropdown menu type selection in the workflow.
33+
- `jvm` image type is for official docker image (to be hosted on apache/kafka) as described in [KIP-975](https://cwiki.apache.org/confluence/display/KAFKA/KIP-975%3A+Docker+Image+for+Apache+Kafka)
34+
- `native` image type is for graalvm based `native` kafka docker image (to be hosted on apache/kafka-native) as described in [KIP-974](https://cwiki.apache.org/confluence/display/KAFKA/KIP-974%3A+Docker+Image+for+GraalVM+based+Native+Kafka+Broker#KIP974:DockerImageforGraalVMbasedNativeKafkaBroker-ImageNaming)
3135

32-
- Example:-
36+
- Example(jvm):-
3337
To build and test a jvm image type ensuring kafka to be containerised should be https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz (it is recommended to use scala 2.13 binary tarball), following inputs in github actions workflow are recommended.
3438
```
3539
image_type: jvm
3640
kafka_url: https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
3741
```
38-
42+
- Example(native):-
43+
To build and test a native image type ensuring kafka to be containerised should be https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz (it is recommended to use scala 2.13 binary tarball), following inputs in github actions workflow are recommended.
44+
```
45+
image_type: native
46+
kafka_url: https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
47+
```
3948
Creating a Release Candidate using github actions
4049
-------------------------------------------------
4150

4251
- This is the recommended way to push an RC docker image.
4352
- Go to `Build and Push Release Candidate Docker Image` Github Actions Workflow.
4453
- Choose the `image_type` and provide `kafka_url` that needs to be containerised in the `rc_docker_image` that will be pushed to github.
45-
- Example:-
54+
- Example(jvm):-
4655
If you want to push a jvm image which contains kafka from https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz to dockerhub under the namespace apache, repo name as kafka and image tag as 3.6.0-rc1 then following values need to be added in Github Actions Workflow:-
4756
```
4857
image_type: jvm
4958
kafka_url: https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
5059
rc_docker_image: apache/kafka:3.6.0-rc0
5160
```
61+
- Example(native):-
62+
If you want to push a native image which contains kafka from https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz to dockerhub under the namespace apache, repo name as kafka-native and image tag as 3.8.0-rc0 then following values need to be added in Github Actions Workflow:-
63+
```
64+
image_type: native
65+
kafka_url: https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
66+
rc_docker_image: apache/kafka-native:3.8.0-rc0
67+
```
5268

5369
Promoting a Release Candidate using github actions
5470
--------------------------------------------------
5571

5672
- This is the recommended way to promote an RC docker image.
5773
- Go to `Promote Release Candidate Docker Image` Github Actions Workflow.
5874
- Choose the RC docker image (`rc_docker_image`) that you want to promote and where it needs to be pushed to (`promoted_docker_image`), i.e. the final docker image release.
59-
- Example:-
75+
- Example(jvm):-
6076
If you want to promote apache/kafka:3.6.0-rc0 RC docker image to apache/kafka:3.6.0 then following parameters can be provided to the workflow.
6177
```
6278
rc_docker_image: apache/kafka:3.6.0-rc0
6379
promoted_docker_image: apache/kafka:3.6.0
6480
```
81+
- Example(native):-
82+
If you want to promote apache/kafka-native:3.8.0-rc0 RC docker image to apache/kafka-native:3.8.0 then following parameters can be provided to the workflow.
83+
```
84+
rc_docker_image: apache/kafka-native:3.8.0-rc0
85+
promoted_docker_image: apache/kafka-native:3.8.0
86+
```
6587

6688
Cron job for checking CVEs in supported docker images
6789
-----------------------------------------------------
@@ -100,22 +122,32 @@ Building image and running tests locally
100122
- Sanity tests for the docker image are present in test/docker_sanity_test.py.
101123
- By default image will be built and tested, but if you only want to build the image, pass `--build` (or `-b`) flag and if you only want to test the given image pass `--test` (or `-t`) flag.
102124
- An html test report will be generated after the tests are executed containing the results.
103-
- Example :- To build and test an image named test under kafka namespace with 3.6.0 tag and jvm image type ensuring kafka to be containerised should be https://downloads.apache.org/kafka/3.6.0/kafka_2.13-3.6.0.tgz (it is recommended to use scala 2.13 binary tarball), following command can be used
125+
- Example(jvm) :- To build and test an image named test under kafka namespace with 3.6.0 tag and jvm image type ensuring kafka to be containerised should be https://downloads.apache.org/kafka/3.6.0/kafka_2.13-3.6.0.tgz (it is recommended to use scala 2.13 binary tarball), following command can be used
104126
```
105127
python docker_build_test.py kafka/test --image-tag=3.6.0 --image-type=jvm --kafka-url=https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
106128
```
129+
- Example(native) :- To build and test an image named test under kafka namespace with 3.8.0 tag and native image type ensuring kafka to be containerised should be https://downloads.apache.org/kafka/3.8.0/kafka_2.13-3.8.0.tgz (it is recommended to use scala 2.13 binary tarball), following command can be used
130+
```
131+
python docker_build_test.py kafka/test --image-tag=3.8.0 --image-type=native --kafka-url=https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
132+
```
107133

108134
Creating a Release Candidate
109135
----------------------------
110136

111137
- `docker_release.py` script builds a multi-architecture image and pushes it to provided docker registry.
112138
- Ensure you are logged in to the docker registry before triggering the script.
113139
- kafka binary tarball url along with image name (in the format `<registry>/<namespace>/<image_name>:<image_tag>`) and type is needed to build the image. For detailed usage description check `python docker_release.py --help`.
114-
- Example:- To push an image named test under kafka dockerhub namespace with 3.6.0 tag and jvm image type ensuring kafka to be containerised should be https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz (it is recommended to use scala 2.13 binary tarball), following command can be used. (Make sure you have push access to the docker repo)
140+
- Example(jvm):- To push an image named test under kafka dockerhub namespace with 3.6.0 tag and jvm image type ensuring kafka to be containerised should be https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz (it is recommended to use scala 2.13 binary tarball), following command can be used. (Make sure you have push access to the docker repo)
115141
```
116142
# kafka/test is an example repo. Please replace with the docker hub repo you have push access to.
117143
118-
python docker_release.py kafka/test:3.6.0 --kafka-url https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
144+
python docker_release.py kafka/test:3.6.0 --kafka-url --image-type=jvm https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
145+
```
146+
- Example(native):- To push an image named test under kafka-native dockerhub namespace with 3.8.0 tag and native image type ensuring kafka to be containerised should be https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz (it is recommended to use scala 2.13 binary tarball), following command can be used. (Make sure you have push access to the docker repo)
147+
```
148+
# kafka-native/test is an example repo. Please replace with the docker hub repo you have push access to.
149+
150+
python docker_release.py kafka-native/test:3.8.0 --kafka-url --image-type=native https://archive.apache.org/dist/kafka/3.8.0/kafka_2.13-3.8.0.tgz
119151
```
120152

121153
- Please note that we use docker buildx for preparing the multi-architecture image and pushing it to docker registry. It's possible to encounter build failures because of buildx. Please retry the command in case some buildx related error occurs.
@@ -124,12 +156,18 @@ Promoting a Release Candidate
124156
-----------------------------
125157

126158
- It's not recommended to promote the docker image locally, as we have github actions doing it in a convenient way, but if needed following command can be used to promote a Release Candidate image.
127-
- Example:- If you want to promote RC image apache/kafka:3.6.0-rc0 to apache/kafka:3.6.0, following command can be used
159+
- Example(jvm):- If you want to promote RC image apache/kafka:3.6.0-rc0 to apache/kafka:3.6.0, following command can be used
128160

129161
```
130162
# Ensure docker buildx is enabled in your system and you have access to apache/kafka
131163
docker buildx imagetools create --tag apache/kafka:3.6.0 apache/kafka:3.6.0-rc0
132164
```
165+
- Example(native):- If you want to promote RC image apache/kafka-native:3.8.0-rc0 to apache/kafka-native:3.8.0, following command can be used
166+
167+
```
168+
# Ensure docker buildx is enabled in your system and you have access to apache/kafka-native
169+
docker buildx imagetools create --tag apache/kafka-native:3.8.0 apache/kafka-native:3.8.0-rc0
170+
```
133171

134172
Using the image in a docker container
135173
-------------------------------------
@@ -172,5 +210,6 @@ python generate_kafka_pr_template.py --image-type=jvm
172210
```
173211

174212
- kafka-version - This is the version to create the Docker official images static Dockerfile and assets for, as well as the version to build and test the Docker official image for.
175-
- image-type - This is the type of image that we intend to build. This will be dropdown menu type selection in the workflow. `jvm` image type is for official docker image (to be hosted on apache/kafka) as described in [KIP-975](https://cwiki.apache.org/confluence/display/KAFKA/KIP-975%3A+Docker+Image+for+Apache+Kafka). As of now [KIP-1028](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1028%3A+Docker+Official+Image+for+Apache+Kafka) only aims to release JVM based Docker Official Images.
213+
- image-type - This is the type of image that we intend to build. This will be dropdown menu type selection in the workflow. `jvm` image type is for official docker image (to be hosted on apache/kafka) as described in [KIP-975](https://cwiki.apache.org/confluence/display/KAFKA/KIP-975%3A+Docker+Image+for+Apache+Kafka).
214+
- **NOTE:** As of now [KIP-1028](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1028%3A+Docker+Official+Image+for+Apache+Kafka) only aims to release JVM based Docker Official Images and not GraalVM based native Apache Kafka docker image.
176215

0 commit comments

Comments
 (0)