-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KAFKA-16827: Integrate kafka native-image with system tests (#16046)
This PR does following things System tests should bring up Kafka broker in the native mode System tests should run on Kafka broker in native mode Extract out native build command so that it can be reused. Allow system tests to run on Native Kafka broker using Docker mechanism To run system tests by bringing up Kafka in native mode: Pass kafka_mode as native in the ducktape globals:--globals '{\"kafka_mode\":\"native\"}' Running system tests by bringing up kafka in native mode via docker mechanism _DUCKTAPE_OPTIONS="--globals '{\"kafka_mode\":\"native\"}'" TC_PATHS="tests/kafkatest/tests/" bash tests/docker/run_tests.sh To only bring up ducker nodes to cater native kafka bash tests/docker/ducker-ak up -m native Reviewers: Manikumar Reddy <[email protected]>
- Loading branch information
1 parent
bb7db87
commit bb6a042
Showing
11 changed files
with
166 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# $1 - The path of the GraalVM native-image. This binary is used to compile Java applications ahead-of-time into a standalone native binary. | ||
# $2 - The path of the directory that contains the native-image configuration files. | ||
# $3 - The path of the directory that contains the Apache Kafka libs. | ||
# $4 - The path of the resulting Kafka native binary after the build process. | ||
|
||
$1 --no-fallback \ | ||
--enable-http \ | ||
--enable-https \ | ||
--allow-incomplete-classpath \ | ||
--report-unsupported-elements-at-runtime \ | ||
--install-exit-handlers \ | ||
--enable-monitoring=jmxserver,jmxclient,heapdump,jvmstat \ | ||
-H:+ReportExceptionStackTraces \ | ||
-H:+EnableAllSecurityServices \ | ||
-H:EnableURLProtocols=http,https \ | ||
-H:AdditionalSecurityProviders=sun.security.jgss.SunProvider \ | ||
-H:ReflectionConfigurationFiles="$2"/reflect-config.json \ | ||
-H:JNIConfigurationFiles="$2"/jni-config.json \ | ||
-H:ResourceConfigurationFiles="$2"/resource-config.json \ | ||
-H:SerializationConfigurationFiles="$2"/serialization-config.json \ | ||
-H:PredefinedClassesConfigurationFiles="$2"/predefined-classes-config.json \ | ||
-H:DynamicProxyConfigurationFiles="$2"/proxy-config.json \ | ||
--verbose \ | ||
-march=compatibility \ | ||
-cp "$3/*" kafka.docker.KafkaDockerWrapper \ | ||
-o "$4" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,34 @@ | |
# limitations under the License. | ||
|
||
ARG jdk_version=openjdk:8 | ||
FROM $jdk_version AS build-native-image | ||
|
||
WORKDIR /build | ||
|
||
COPY native/ native | ||
|
||
ARG KAFKA_MODE | ||
ARG GRAALVM_URL="https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.1/graalvm-community-jdk-21.0.1_linux-aarch64_bin.tar.gz" | ||
|
||
ENV NATIVE_IMAGE_PATH="/build/graalvm/bin/native-image" | ||
ENV NATIVE_CONFIGS_DIR="/build/native/native-image-configs" | ||
ENV KAFKA_LIBS_DIR="/build/kafka/libs" | ||
ENV KAFKA_BIN_DIR="/build/kafka-binary" | ||
ENV TARGET_PATH="$KAFKA_BIN_DIR/kafka.Kafka" | ||
|
||
RUN mkdir $KAFKA_BIN_DIR | ||
|
||
RUN if [ "$KAFKA_MODE" = "native" ]; then \ | ||
apt update && apt install -y sudo build-essential libz-dev zlib1g-dev curl jq coreutils libffi-dev cmake pkg-config libfuse-dev && apt-get -y clean ; \ | ||
mkdir graalvm ; \ | ||
curl -L "$GRAALVM_URL" -o graalvm.tar.gz ; \ | ||
tar -xzf graalvm.tar.gz -C graalvm --strip-components=1 ; \ | ||
mkdir kafka ; \ | ||
tar xfz native/kafka.tgz -C kafka --strip-components 1 ; \ | ||
rm graalvm.tar.gz kafka.tgz ; \ | ||
/build/native/native_command.sh $NATIVE_IMAGE_PATH $NATIVE_CONFIGS_DIR $KAFKA_LIBS_DIR $TARGET_PATH ; \ | ||
fi | ||
|
||
FROM $jdk_version | ||
|
||
MAINTAINER Apache Kafka [email protected] | ||
|
@@ -37,6 +65,7 @@ RUN apt update && apt install -y sudo git netcat iptables rsync unzip wget curl | |
RUN python3 -m pip install -U pip==21.1.1; | ||
RUN pip3 install --upgrade cffi virtualenv pyasn1 boto3 pycrypto pywinrm ipaddress enum34 debugpy && pip3 install --upgrade "ducktape>0.8" | ||
|
||
COPY --from=build-native-image /build/kafka-binary/ /opt/kafka-binary/ | ||
# Set up ssh | ||
COPY ./ssh-config /root/.ssh/config | ||
# NOTE: The paramiko library supports the PEM-format private key, but does not support the RFC4716 format. | ||
|
@@ -107,7 +136,7 @@ ARG KIBOSH_VERSION="8841dd392e6fbf02986e2fb1f1ebf04df344b65a" | |
ARG UID="1000" | ||
|
||
# Install Kibosh | ||
RUN apt-get install fuse | ||
RUN apt-get install fuse -y | ||
RUN cd /opt && git clone -q https://github.com/confluentinc/kibosh.git && cd "/opt/kibosh" && git reset --hard $KIBOSH_VERSION && mkdir "/opt/kibosh/build" && cd "/opt/kibosh/build" && ../configure && make -j 2 | ||
|
||
# Set up the ducker user. | ||
|
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.