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

GraalVM native-image builds based on the Kafka 2.6.0 release #31

Merged
merged 25 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f0aebc8
Removes unused java distributions
solsson Aug 15, 2020
9f0a6de
Fixes a step arg so the command runs properly
solsson Aug 15, 2020
cfdd618
Adds the jopts exception class to reflect config
solsson Aug 15, 2020
7e4ea0c
Regenerate native configs with Kafka 2.6.0
solsson Aug 15, 2020
2f21a61
Current Quarkus
solsson Aug 15, 2020
576ecd5
Fixes a warning emitted at build time
solsson Aug 15, 2020
4e46018
Scala issues about the native-image + java.lang.invoke.MemberName
solsson Aug 15, 2020
bdd2195
Dammit scala
solsson Aug 16, 2020
fc8a77f
Fixes the zookeeper native-image JMX NPE, see #31
solsson Aug 16, 2020
7da9b9b
We've gotten rid of log4j and JMX; fix native-image warnings
solsson Aug 16, 2020
b9901ef
Can we do scala substitutions without scala libs?
solsson Aug 16, 2020
90fe465
Various experiments that failed to fix "unresolved" X509Util stuff
solsson Aug 16, 2020
94704b3
Scope out TLS support, again, until represented in native-usecases
solsson Aug 16, 2020
abaf382
Consistent builds. Admincmd fails to substitute the scala signature.
solsson Aug 16, 2020
1e33b4e
Betting that CLIs don't actually need metrics. We'd see runtime errors.
solsson Aug 16, 2020
695f84f
Fixes native-image build error \"unresolved type during parsing\"
solsson Aug 16, 2020
f4dfdf9
Explicit initialization config could be quite interesting for
solsson Aug 16, 2020
6b7d99c
Fixes all warnings about incomplete classpath with initialize-at-buil…
solsson Aug 16, 2020
9826bff
Despite the addition of these classpath entries,
solsson Aug 16, 2020
e8da8a7
Maybe --initialize-at-build-time should be removed after we've tracked
solsson Aug 16, 2020
510f8ba
Actually with the more ambitious classpath we're stuck with
solsson Aug 16, 2020
b43a8da
Has been solved with substitution
solsson Aug 16, 2020
6cb1202
Maybe down this rabbit hole we should use the entire libs folder again
solsson Aug 16, 2020
37ca8d6
Fixes a warning about incomplete classpath
solsson Aug 16, 2020
4187935
Zero warnings about incomplete classpath
solsson Aug 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Very experimental.
NOPUSH=true IMAGE_NAME=solsson/kafka:nativeagent ./hooks/build
docker-compose -f native/docker-compose.yml down
docker run --rm --entrypoint chown -v $(pwd)/native/configs:/configs busybox -R $(id -u) /configs
# after reviewing config changes with git add -p native/configs
NOPUSH=true IMAGE_NAME=solsson/kafka:native ./hooks/build
```

Expand Down
30 changes: 0 additions & 30 deletions jdk-oracle-open/Dockerfile

This file was deleted.

41 changes: 0 additions & 41 deletions jdk-zulu/Dockerfile

This file was deleted.

2 changes: 2 additions & 0 deletions native/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/.*
**/target
12 changes: 9 additions & 3 deletions native/admincmd.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
FROM solsson/kafka:graalvm as substitutions

WORKDIR /workspace
COPY substitutions/admincmd .
RUN mvn package

FROM adoptopenjdk:11.0.8_10-jdk-hotspot-bionic@sha256:0513c0a82a82d1c9f4bfed18ef57bd5551ced2656342426a772c4772286dae1e \
as nonlibs
RUN echo "class Empty {public static void main(String[] a){}}" > Empty.java && javac Empty.java && jar --create --file /empty.jar Empty.class
Expand All @@ -7,12 +13,13 @@ FROM curlimages/curl@sha256:aa45e9d93122a3cfdf8d7de272e2798ea63733eeee6d06bd2ee4

USER root
RUN curl -sLS -o /slf4j-nop-1.7.30.jar https://repo1.maven.org/maven2/org/slf4j/slf4j-nop/1.7.30/slf4j-nop-1.7.30.jar
RUN curl -sLS -o /quarkus-kafka-client-1.6.0.Final.jar https://repo1.maven.org/maven2/io/quarkus/quarkus-kafka-client/1.6.0.Final/quarkus-kafka-client-1.6.0.Final.jar
RUN curl -sLS -o /quarkus-kafka-client-1.7.0.Final.jar https://repo1.maven.org/maven2/io/quarkus/quarkus-kafka-client/1.7.0.Final/quarkus-kafka-client-1.7.0.Final.jar

FROM solsson/kafka:nativebase as native

ARG classpath=/opt/kafka/libs/extensions/*:/opt/kafka/libs/*

COPY --from=substitutions /workspace/target/*.jar /opt/kafka/libs/extensions/substitutions.jar
COPY --from=extralibs /*.jar /opt/kafka/libs/extensions/

# docker run --rm --entrypoint ls solsson/kafka -l /opt/kafka/libs/ | grep log
Expand All @@ -29,8 +36,7 @@ RUN native-image \
-H:IncludeResourceBundles=joptsimple.ExceptionMessages \
-H:ConfigurationFileDirectories=/home/nonroot/native-config \
# When testing the build for a new version we should remove this one, but then it tends to come back
--allow-incomplete-classpath \
--report-unsupported-elements-at-runtime \
--initialize-at-build-time \
# -D options from entrypoint
-Djava.awt.headless=true \
-Dkafka.logs.dir=/opt/kafka/bin/../logs \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
{
"name": "org.apache.log4j.helpers.Loader"
},
{
"name": "io.netty.util.internal.logging.Log4J2Logger"
},
{
"name": "sun.security.provider.ConfigFile",
"methods": [
Expand Down
15 changes: 6 additions & 9 deletions native/configs/kafka-configs/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"name":"java.lang.ThreadLocal",
"methods":[{"name":"remove","parameterTypes":[] }]
},
{
"name":"java.lang.invoke.VarHandle"
},
{
"name":"java.util.AbstractMap",
"allDeclaredFields":true,
Expand Down Expand Up @@ -102,16 +105,10 @@
"methods":[{"name":"<init>","parameterTypes":["org.apache.zookeeper.client.ZKClientConfig"] }]
},
{
"name":"scala.Serializable",
"allDeclaredMethods":true
},
{
"name":"scala.Tuple2[]"
},
{
"name":"scala.collection.convert.Wrappers$MapWrapper",
"name":"scala.collection.convert.JavaCollectionWrappers$MapWrapper",
"allDeclaredFields":true,
"allDeclaredMethods":true
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"sun.security.provider.ConfigFile",
Expand Down
3 changes: 3 additions & 0 deletions native/configs/kafka-consumer-groups/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"name":"java.lang.Thread",
"methods":[{"name":"getContextClassLoader","parameterTypes":[] }]
},
{
"name":"java.lang.invoke.VarHandle"
},
{
"name":"kafka.admin.ConsumerGroupCommand$PartitionAssignmentState[]"
},
Expand Down
41 changes: 16 additions & 25 deletions native/configs/kafka-server-start/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.lang.Runnable[]"
},
{
"name":"java.lang.Runtime",
"methods":[{"name":"version","parameterTypes":[] }]
Expand All @@ -61,6 +58,9 @@
"name":"java.lang.ThreadLocal",
"methods":[{"name":"remove","parameterTypes":[] }]
},
{
"name":"java.lang.invoke.VarHandle"
},
{
"name":"java.util.AbstractCollection",
"allDeclaredFields":true,
Expand Down Expand Up @@ -91,16 +91,10 @@
{
"name":"java.util.zip.CRC32C"
},
{
"name":"kafka.server.DelayedOperationPurgatory$WatcherList[]"
},
{
"name":"kafka.utils.Log4jController",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"kafka.utils.timer.TimerTaskList[]"
},
{
"name":"org.apache.kafka.common.protocol.types.Struct[]"
},
Expand Down Expand Up @@ -150,35 +144,32 @@
"allDeclaredMethods":true
},
{
"name":"scala.Serializable",
"allDeclaredMethods":true
},
{
"name":"scala.Tuple2[]"
},
{
"name":"scala.collection.convert.Wrappers$IterableWrapperTrait",
"name":"scala.collection.convert.JavaCollectionWrappers$IterableWrapperTrait",
"allDeclaredMethods":true
},
{
"name":"scala.collection.convert.Wrappers$MapWrapper",
"name":"scala.collection.convert.JavaCollectionWrappers$MapWrapper",
"allDeclaredFields":true,
"allDeclaredMethods":true
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"scala.collection.convert.Wrappers$MutableBufferWrapper",
"name":"scala.collection.convert.JavaCollectionWrappers$MutableBufferWrapper",
"allDeclaredFields":true,
"allDeclaredMethods":true
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"scala.collection.convert.Wrappers$MutableMapWrapper",
"name":"scala.collection.convert.JavaCollectionWrappers$MutableMapWrapper",
"allDeclaredFields":true,
"allDeclaredMethods":true
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"scala.collection.convert.Wrappers$SeqWrapper",
"name":"scala.collection.convert.JavaCollectionWrappers$SeqWrapper",
"allDeclaredFields":true,
"allDeclaredMethods":true
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"sun.misc.Signal",
Expand Down
9 changes: 3 additions & 6 deletions native/configs/kafka-topics/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"name":"com.fasterxml.jackson.databind.ext.Java7SupportImpl",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"io.netty.util.internal.logging.Log4J2Logger"
},
{
"name":"java.lang.Integer",
"methods":[{"name":"valueOf","parameterTypes":["java.lang.String"] }]
Expand Down Expand Up @@ -33,6 +30,9 @@
"name":"java.lang.ThreadLocal",
"methods":[{"name":"remove","parameterTypes":[] }]
},
{
"name":"java.lang.invoke.VarHandle"
},
{
"name":"kafka.utils.Log4jController",
"methods":[{"name":"<init>","parameterTypes":[] }]
Expand Down Expand Up @@ -74,9 +74,6 @@
"name":"org.apache.zookeeper.ClientCnxnSocketNIO",
"methods":[{"name":"<init>","parameterTypes":["org.apache.zookeeper.client.ZKClientConfig"] }]
},
{
"name":"scala.Tuple2[]"
},
{
"name":"sun.security.provider.ConfigFile",
"methods":[{"name":"<init>","parameterTypes":[] }]
Expand Down
27 changes: 1 addition & 26 deletions native/configs/zookeeper-server-start/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,18 @@
"name":"org.apache.log4j.Category",
"methods":[{"name":"getName","parameterTypes":[] }]
},
{
"name":"org.apache.log4j.CategoryKey"
},
{
"name":"org.apache.log4j.ConsoleAppender",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"org.apache.log4j.Hierarchy",
"methods":[{"name":"getCurrentLoggers","parameterTypes":[] }]
},
{
"name":"org.apache.log4j.Layout"
},
{
"name":"org.apache.log4j.Level"
},
{
"name":"org.apache.log4j.LogManager",
"methods":[{"name":"getLoggerRepository","parameterTypes":[] }]
"name":"org.apache.log4j.LogManager"
},
{
"name":"org.apache.log4j.Logger",
Expand All @@ -57,23 +49,6 @@
{
"name":"org.apache.log4j.Priority"
},
{
"name":"org.apache.log4j.jmx.AppenderDynamicMBean",
"allPublicConstructors":true
},
{
"name":"org.apache.log4j.jmx.HierarchyDynamicMBean",
"allPublicConstructors":true,
"methods":[{"name":"addLoggerMBean","parameterTypes":["java.lang.String"] }]
},
{
"name":"org.apache.log4j.jmx.LayoutDynamicMBean",
"allPublicConstructors":true
},
{
"name":"org.apache.log4j.jmx.LoggerDynamicMBean",
"allPublicConstructors":true
},
{
"name":"org.apache.log4j.spi.OptionHandler"
},
Expand Down
9 changes: 8 additions & 1 deletion native/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@
- --group=testgroup
- --topic=topic1
- --reset-offsets
- --to-offset 0
- --to-offset=0
#- --execute intentionally left out, for the dry-run use case

step7:
image: solsson/kafka:nativeagent-kafka-consumer-groups
Expand Down Expand Up @@ -165,6 +166,12 @@
- --add-config
- max.message.bytes=2048

step10:
image: solsson/kafka:nativeagent-kafka-consumer-groups
volumes: [ ./configs/kafka-consumer-groups:/home/nonroot/native-config ]
command:
- --intentionally wrong

kafkacat:
image: edenhill/kafkacat:1.5.0
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion native/native-usecases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ $compose up -d kafka-0
$compose up -d kafkacat
$compose ps

for step in $(seq 1 9); do
for step in $(seq 1 10); do
$compose up step$step
done
4 changes: 4 additions & 0 deletions native/substitutions/admincmd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.classpath
.project
.settings
target
Loading