From c97b42517e91fd8c66274c12cd2958417771fbf1 Mon Sep 17 00:00:00 2001 From: Adi Muraru Date: Thu, 29 Oct 2026 15:24:35 +0100 Subject: [PATCH 1/7] chore: target Java 25 LTS in Java image builds Align Kafka, and Spring example builds on Java 25, refresh base image digests, and constrain Renovate to the LTS line. Keep deployed Kafka image references on published tags until the Java 25 images are released. JMX exporter is still targetting java 21 as the docker image is also injected in cruise-control which is not on java-25 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/publish-kafka-docker.yml | 7 +++- docker/jmx_exporter/Dockerfile | 7 ++-- docker/kafka/Dockerfile | 8 ++-- docker/kafka/README.md | 38 ++++++++++++++++++- .../examples/springboot-kafka-avro/Dockerfile | 4 +- docs/examples/springboot-kafka-avro/pom.xml | 15 +++++++- renovate.json | 15 +++++++- 7 files changed, 82 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-kafka-docker.yml b/.github/workflows/publish-kafka-docker.yml index 8515282a9..d82321977 100644 --- a/.github/workflows/publish-kafka-docker.yml +++ b/.github/workflows/publish-kafka-docker.yml @@ -53,6 +53,11 @@ jobs: run: | KAFKA_VERSION=$(echo "${{ needs.prepare.outputs.tag }}" | sed 's/kafka-//') echo "kafka_version=$KAFKA_VERSION" >> $GITHUB_OUTPUT + - name: Extract Java version from Dockerfile + id: java_version + run: | + JAVA_VERSION=$(grep '^ARG java_version=' docker/kafka/Dockerfile | cut -d'=' -f2 | cut -d' ' -f1) + echo "java_version=$JAVA_VERSION" >> $GITHUB_OUTPUT - name: Check if Kafka image already exists id: image_exists run: | @@ -91,7 +96,7 @@ jobs: tags: | type=match,pattern=kafka-(.*),group=1 labels: | - org.opencontainers.image.description=Apache Kafka with OpenJDK 21 + org.opencontainers.image.description=Apache Kafka with Oracle JDK ${{ steps.java_version.outputs.java_version }} - name: Build and push kafka image if: startsWith(github.ref, 'refs/tags/') && steps.image_exists.outputs.exists == 'false' uses: docker/build-push-action@v7 diff --git a/docker/jmx_exporter/Dockerfile b/docker/jmx_exporter/Dockerfile index 9081a73fd..338109c37 100644 --- a/docker/jmx_exporter/Dockerfile +++ b/docker/jmx_exporter/Dockerfile @@ -1,10 +1,10 @@ ARG JMX_EXPORTER_VERSION=1.7.0 # renovate: datasource=github-releases depName=prometheus/jmx_exporter -FROM maven:3-amazoncorretto-21@sha256:9b868ffa88a46d8b4e605fa14db1e0debe2edb798b3b5890156e92d55a17b11b AS build +FROM maven:3-amazoncorretto-25@sha256:d96c6ff2e7a3258e6f0c447340d2284a3404917bb8c5f01c8660cc4066bd382c AS build ARG JMX_EXPORTER_VERSION -# Install wget to download the release tarball -RUN yum install -y wget && yum clean all +# Install tools to download and extract the release tarball +RUN yum install -y wget tar gzip && yum clean all # Download and extract the JMX exporter release RUN wget https://github.com/prometheus/jmx_exporter/archive/refs/tags/${JMX_EXPORTER_VERSION}.tar.gz \ @@ -14,6 +14,7 @@ RUN wget https://github.com/prometheus/jmx_exporter/archive/refs/tags/${JMX_EXPO rm /tmp/jmx_exporter.tar.gz WORKDIR /src +# Keep the agent compatible with Java 21 consumers while building with JDK 25. RUN mvn -B -Dmaven.javadoc.skip=true -Dskip.javadoc=true \ -Dmaven.compiler.source=21 -Dmaven.compiler.target=21 -Dmaven.compiler.release=21 \ clean package -pl jmx_prometheus_javaagent -am && \ diff --git a/docker/kafka/Dockerfile b/docker/kafka/Dockerfile index bd6d220e5..d2287598d 100644 --- a/docker/kafka/Dockerfile +++ b/docker/kafka/Dockerfile @@ -2,9 +2,8 @@ ARG scala_version=2.13 # Renovate is pinned to the 3.x line (see the apache/kafka packageRule in renovate.json). # Kafka 4.x removes ZooKeeper support entirely (KRaft-only) and needs an operator-side # migration; when this repo is ready for that, drop the allowedVersions constraint too. -# Also bump java_version to 25 (next LTS after 21) as part of that migration. ARG KAFKA_VERSION=3.9.2 # renovate: datasource=github-tags depName=apache/kafka -ARG java_version=21 +ARG java_version=25 FROM alpine:latest@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6 AS kafka_dist @@ -34,7 +33,7 @@ RUN apk add --no-cache gnupg wget && \ # backported from https://github.com/docker-library/openjdk/blob/master/18/jdk/slim-bullseye/Dockerfile -FROM debian:trixie-slim@sha256:a29215f6a35e51e22adffa17f89e9d2ef06214e64a2bad10d765c46aea49f11f +FROM debian:stable-slim@sha256:13e0a2e78aa0554ad5ff66e4e260c6dbcdff807eb1f39d43b9fb0288aae88b04 ARG scala_version ARG KAFKA_VERSION @@ -57,6 +56,9 @@ ENV PATH=$JAVA_HOME/bin:$PATH ENV LANG=C.UTF-8 ENV JAVA_VERSION=${java_version} +# Apply Java 25 defaults before generating the CDS archive. +ENV JDK_JAVA_OPTIONS="--enable-native-access=ALL-UNNAMED --illegal-native-access=deny -XX:+UseCompactObjectHeaders" + RUN set -eux; \ \ arch="$(dpkg --print-architecture)"; \ diff --git a/docker/kafka/README.md b/docker/kafka/README.md index fea35b695..352e8617a 100644 --- a/docker/kafka/README.md +++ b/docker/kafka/README.md @@ -9,5 +9,41 @@ Tags should be `kafka--` e.g `kafak-2.13-2.6.2` # Upstream base This is based on [wurstmeister/kafka-docker](https://github.com/wurstmeister/kafka-docker) with the following additions: -1. Use `openjdk 21` in order to support container based resource monitoring +1. Use Oracle JDK 25 LTS with container based resource monitoring 2. Use custom `log4j.properties` to get all kafka logs to stdout only + +## Java 25 runtime defaults + +The image sets `JDK_JAVA_OPTIONS` to: + +```text +--enable-native-access=ALL-UNNAMED --illegal-native-access=deny -XX:+UseCompactObjectHeaders +``` + +These options permit Kafka's classpath-based native compression libraries, reject +native access that has not been granted, and enable compact object headers. The +CDS archive is generated with the same options. + +The defaults apply to Java launches in this image, including Kafka's storage and +command-line tools, without replacing `KAFKA_OPTS` used for the JMX agent. They +are not added to the operator's shared JVM defaults: Java 21 images reject the +native-access deny option and compact object headers. + +## Java 25 rollout + +The Kafka image build targets Java 25 LTS independently of the Kafka 4.x migration. +Kafka remains on 3.9.x to preserve ZooKeeper support. + +Operator defaults, samples, benchmark manifests, and the vendored Cruise Control +Compose configuration still reference the published Java 21 Kafka image. After +validating Kafka startup, SASL/TLS authentication, and the JMX exporter on Java 25, +publish a new `kafka---jdk` release tag. +Then update those image references and refresh any pinned image digests together. +Do not point them at an unpublished tag or reuse a Java 21 image digest. + +The rebuilt JMX exporter uses JDK 25 to compile Java 21 bytecode, so the agent +supports both Java 21 and Java 25; the jar is functionally equivalent to the one +built with the previous JDK 21 builder, so no agent rebuild is required before +updating consumers. The release workflow tags the agent image with the +`JMX_EXPORTER_VERSION` from its Dockerfile and skips tags that already exist, so +the JDK 25 builder only takes effect at the next jmx_exporter upstream release. diff --git a/docs/examples/springboot-kafka-avro/Dockerfile b/docs/examples/springboot-kafka-avro/Dockerfile index 5a9f443d4..1227b46de 100644 --- a/docs/examples/springboot-kafka-avro/Dockerfile +++ b/docs/examples/springboot-kafka-avro/Dockerfile @@ -1,4 +1,4 @@ -FROM maven:3.10-eclipse-temurin-21-alpine@sha256:e2359c0c326fc120e375affa68bcab2fc16fca7acf7385a50dd6071da736d281 as build +FROM maven:3.10-eclipse-temurin-25-alpine@sha256:5d74a0f788b3cca0d36a4a3f358eadc8b0dd6f2f4f2dfcd0091b0cd5934d3002 as build # Set working directory WORKDIR /usr/src/myapp @@ -12,7 +12,7 @@ COPY src ./src RUN mvn clean package -DskipTests # The final image should have minimal layers -FROM eclipse-temurin:27-jre-alpine@sha256:9d76de111573e77ac415d8344271a2e57dd19bd59c48725fa3bac38c101bd0ba +FROM eclipse-temurin:25-jre-alpine@sha256:b7528962e65d43064d8a8b67ba175367896bc948363ea2d3fcd7f10d34e1f048 RUN apk add --no-cache curl COPY --from=build /usr/src/myapp/target/kafka-avro-0.0.1-SNAPSHOT.jar app.jar ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file diff --git a/docs/examples/springboot-kafka-avro/pom.xml b/docs/examples/springboot-kafka-avro/pom.xml index 13ea1dab4..3d7c2cc5d 100644 --- a/docs/examples/springboot-kafka-avro/pom.xml +++ b/docs/examples/springboot-kafka-avro/pom.xml @@ -15,7 +15,7 @@ Demo project for Spring Boot - 21 + 25 @@ -62,6 +62,19 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.projectlombok + lombok + ${lombok.version} + + + + org.springframework.boot spring-boot-maven-plugin diff --git a/renovate.json b/renovate.json index e0895b6ab..f4b9dcb07 100644 --- a/renovate.json +++ b/renovate.json @@ -167,6 +167,18 @@ "patch" ] }, + { + "matchDatasources": ["docker"], + "matchPackageNames": ["maven"], + "allowedVersions": "/^3(?:\\.\\d+)*-(?:amazoncorretto-25|eclipse-temurin-25-alpine)$/", + "description": "Keep Maven builders on Java 25 LTS while allowing Maven 3 updates and image digest refreshes." + }, + { + "matchDatasources": ["docker"], + "matchPackageNames": ["eclipse-temurin"], + "allowedVersions": "/^25-jre-alpine$/", + "description": "Keep the Spring example runtime on Java 25 LTS; continue refreshing its image digest." + }, { "matchPackageNames": [ "apache/kafka" @@ -194,8 +206,9 @@ "ghcr.io/adobe/koperator/kafka" ], "matchCurrentValue": "/^\\d+\\.\\d+-\\d+\\.\\d+\\.\\d+(-jdk\\d+\\.\\d+\\.\\d+)?$/", + "allowedVersions": "/^\\d+\\.\\d+-3\\.\\d+\\.\\d+-jdk25\\.\\d+\\.\\d+$/", "versioning": "regex:^(?\\d+\\.\\d+)-(?\\d+)\\.(?\\d+)\\.(?\\d+)(?:-jdk(?\\d+)\\.\\d+\\.(?\\d+))?$", - "description": "Tag format is -[-jdk], e.g. 2.13-3.9.1 or 2.13-3.9.2-jdk21.0.11 (the latter shape shipped starting with the 3.9.2 release tag). Verified live against ghcr.io: default docker versioning parses currentVersion as just '2.13' and silently drops everything after the first hyphen, so Renovate can never see a real 3.9.1->3.9.2 bump (only digest-pin updates fire, via the docker pinDigests rule below) - this affects every '# renovate:' annotated occurrence of this image. Pinning the scala prefix as 'compatibility' (never auto-changed) and parsing the kafka release as major.minor.patch fixes real version comparison. The optional '-jdk..' suffix maps jdk major to 'build' and jdk update to 'revision' (Renovate's regex versioning caps out at 5 numeric levels: major/minor/patch/build/revision, each required to be purely numeric, so the always-0 jdk interim segment is matched but not captured); tags without the suffix default build/revision to 0 and still compare correctly against suffixed ones since a differing kafka patch alone already resolves ordering. This does NOT gate jdk-major jumps (e.g. jdk21.x -> jdk25.x) the way 'compatibility' gates scala - that's covered by the same operator-side migration as the apache/kafka 4.x bump below (see docker/kafka/Dockerfile's java_version comment); revisit if jdk25 lands before that migration." + "description": "Tag format is -[-jdk]. Preserve the Scala compatibility prefix and compare Kafka major/minor/patch followed by JDK major/update. Only propose Kafka 3.x images on Java 25 LTS, independently of the Kafka 4.x migration. Existing Java 21 pins remain usable until a Java 25 image is published." }, { "groupName": "kafka docker images (major)", From fc4f67716eed459d894674cbac06b76940c649ca Mon Sep 17 00:00:00 2001 From: Cameron Wright Date: Tue, 10 Nov 2026 10:12:47 -0500 Subject: [PATCH 2/7] preparing kafka 4.0 for deployment --- .github/workflows/publish-kafka-docker.yml | 17 +++++++ docker/kafka/Dockerfile | 11 ++--- .../kafka/opt/kafka/config/log4j2.properties | 13 ++++++ pkg/resources/kafka/pod.go | 8 ++-- pkg/resources/kafka/pod_test.go | 46 +++++++++++++++++++ renovate.json | 6 +-- 6 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 docker/kafka/opt/kafka/config/log4j2.properties diff --git a/.github/workflows/publish-kafka-docker.yml b/.github/workflows/publish-kafka-docker.yml index 8515282a9..ea3e5f8ce 100644 --- a/.github/workflows/publish-kafka-docker.yml +++ b/.github/workflows/publish-kafka-docker.yml @@ -53,6 +53,23 @@ jobs: run: | KAFKA_VERSION=$(echo "${{ needs.prepare.outputs.tag }}" | sed 's/kafka-//') echo "kafka_version=$KAFKA_VERSION" >> $GITHUB_OUTPUT + - name: Validate tagged Kafka distribution + env: + IMAGE_VERSION: ${{ steps.kafka_version.outputs.kafka_version }} + run: | + set -euo pipefail + if [[ ! "$IMAGE_VERSION" =~ ^([0-9]+\.[0-9]+)-([0-9]+\.[0-9]+\.[0-9]+)(-jdk[0-9]+\.[0-9]+\.[0-9]+)?$ ]]; then + echo "::error::Expected kafka--[-jdk] release tag" + exit 1 + fi + TAG_SCALA="${BASH_REMATCH[1]}" + TAG_KAFKA="${BASH_REMATCH[2]}" + DIST_SCALA=$(sed -nE 's/^ARG scala_version=([^[:space:]]+).*$/\1/p' docker/kafka/Dockerfile) + DIST_KAFKA=$(sed -nE 's/^ARG KAFKA_VERSION=([^[:space:]]+).*$/\1/p' docker/kafka/Dockerfile) + if [[ "$TAG_SCALA" != "$DIST_SCALA" || "$TAG_KAFKA" != "$DIST_KAFKA" ]]; then + echo "::error::Tag $IMAGE_VERSION does not match Dockerfile distribution $DIST_SCALA-$DIST_KAFKA" + exit 1 + fi - name: Check if Kafka image already exists id: image_exists run: | diff --git a/docker/kafka/Dockerfile b/docker/kafka/Dockerfile index bfc824bc6..54930cd74 100644 --- a/docker/kafka/Dockerfile +++ b/docker/kafka/Dockerfile @@ -1,9 +1,6 @@ ARG scala_version=2.13 -# Renovate is pinned to the 3.x line (see the apache/kafka packageRule in renovate.json). -# Kafka 4.x removes ZooKeeper support entirely (KRaft-only) and needs an operator-side -# migration; when this repo is ready for that, drop the allowedVersions constraint too. -# Also bump java_version to 25 (next LTS after 21) as part of that migration. -ARG KAFKA_VERSION=3.9.2 # renovate: datasource=github-tags depName=apache/kafka +# Kafka 4 is KRaft-only. +ARG KAFKA_VERSION=4.0.2 # renovate: datasource=github-tags depName=apache/kafka ARG java_version=21 FROM alpine:latest@sha256:be2656061b536c1883c4034790e21d0a09c5aaaf51968b89368a3c0371ea2c9a AS kafka_dist @@ -139,7 +136,9 @@ RUN apt-get update && \ mkdir -p ${KAFKA_HOME}/libs/extensions COPY --from=kafka_dist /var/tmp/kafka_$scala_version-$KAFKA_VERSION ${KAFKA_HOME} -COPY opt/kafka/config/log4j.properties ${KAFKA_HOME}/config/log4j.properties +COPY opt/kafka/config/log4j2.properties ${KAFKA_HOME}/config/log4j2.properties + +ENV KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=/opt/kafka/config/log4j2.properties" # Optimize Kafka installation: remove unnecessary files and set permissions RUN chmod a+x ${KAFKA_HOME}/bin/*.sh && \ diff --git a/docker/kafka/opt/kafka/config/log4j2.properties b/docker/kafka/opt/kafka/config/log4j2.properties new file mode 100644 index 000000000..8ab03f40c --- /dev/null +++ b/docker/kafka/opt/kafka/config/log4j2.properties @@ -0,0 +1,13 @@ +status=warn +name=KafkaConsole +appender.console.type=Console +appender.console.name=STDOUT +appender.console.target=SYSTEM_OUT +appender.console.layout.type=PatternLayout +appender.console.layout.pattern=[%d] %p %m (%c)%n +rootLogger.level=info +rootLogger.appenderRef.stdout.ref=STDOUT +logger.requests.name=kafka.request.logger +logger.requests.level=warn +logger.authorizer.name=kafka.authorizer.logger +logger.authorizer.level=info diff --git a/pkg/resources/kafka/pod.go b/pkg/resources/kafka/pod.go index 33ddaec3a..527a85261 100644 --- a/pkg/resources/kafka/pod.go +++ b/pkg/resources/kafka/pod.go @@ -656,9 +656,11 @@ func generateEnvConfig(brokerConfig *v1beta1.BrokerConfig, defaultEnvVars []core } if brokerConfig.Log4jConfig != "" { - envs["KAFKA_LOG4J_OPTS"] = corev1.EnvVar{ - Name: "KAFKA_LOG4J_OPTS", - Value: "-Dlog4j.configuration=file:/config/log4j.properties", + if _, configured := envs["KAFKA_LOG4J_OPTS"]; !configured { + envs["KAFKA_LOG4J_OPTS"] = corev1.EnvVar{ + Name: "KAFKA_LOG4J_OPTS", + Value: "-Dlog4j.configuration=file:/config/log4j.properties", + } } } diff --git a/pkg/resources/kafka/pod_test.go b/pkg/resources/kafka/pod_test.go index 0f43e0539..9946d5c45 100644 --- a/pkg/resources/kafka/pod_test.go +++ b/pkg/resources/kafka/pod_test.go @@ -188,6 +188,52 @@ func Test_generateEnvConfig(t *testing.T) { } } +func TestGenerateEnvConfigLogging(t *testing.T) { + for _, test := range []struct { + name string + config string + envs []corev1.EnvVar + expected corev1.EnvVar + expectFound bool + }{ + { + name: "legacy logging default", + config: "log4j.rootLogger=INFO, stdout", + expected: corev1.EnvVar{Name: "KAFKA_LOG4J_OPTS", Value: "-Dlog4j.configuration=file:/config/log4j.properties"}, + expectFound: true, + }, + { + name: "explicit Log4j 2 option", + config: "rootLogger.level=info", + envs: []corev1.EnvVar{{Name: "KAFKA_LOG4J_OPTS", Value: "-Dlog4j2.configurationFile=/config/log4j.properties"}}, + expected: corev1.EnvVar{Name: "KAFKA_LOG4J_OPTS", Value: "-Dlog4j2.configurationFile=/config/log4j.properties"}, + expectFound: true, + }, + { + name: "explicit option from secret", + config: "rootLogger.level=info", + envs: []corev1.EnvVar{{Name: "KAFKA_LOG4J_OPTS", ValueFrom: &corev1.EnvVarSource{SecretKeyRef: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: "logging"}, Key: "opts"}}}}, + expected: corev1.EnvVar{Name: "KAFKA_LOG4J_OPTS", ValueFrom: &corev1.EnvVarSource{SecretKeyRef: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: "logging"}, Key: "opts"}}}, + expectFound: true, + }, + { + name: "image logging default without custom config", + }, + } { + t.Run(test.name, func(t *testing.T) { + result := generateEnvConfig(&v1beta1.BrokerConfig{Log4jConfig: test.config, Envs: test.envs}, nil) + found := false + for _, env := range result { + if env.Name == "KAFKA_LOG4J_OPTS" { + found = true + assert.DeepEqual(t, env, test.expected) + } + } + assert.Equal(t, found, test.expectFound) + }) + } +} + func TestAddDynamicKRaftQuorumFormatEnv(t *testing.T) { brokers := []v1beta1.Broker{ {Id: 0, BrokerConfig: &v1beta1.BrokerConfig{Roles: []string{"controller"}}}, diff --git a/renovate.json b/renovate.json index e0895b6ab..78dbf33d0 100644 --- a/renovate.json +++ b/renovate.json @@ -171,8 +171,8 @@ "matchPackageNames": [ "apache/kafka" ], - "allowedVersions": "<4.0.0", - "description": "Kafka 4.x drops ZooKeeper support (KRaft-only) and needs an operator-side migration. Keep Renovate on the 3.x line until docker/kafka/Dockerfile is ready for that jump, then remove this rule." + "allowedVersions": ">=4.0.2 <4.1.0", + "description": "Kafka 4.0.2 is the OR2 dev upgrade target. Keep distribution updates on the 4.0 line; later minor/major versions require separate validation." }, { "matchCurrentValue": "/^\\d+\\.\\d+\\.\\d+-ado?be-\\d+$/", @@ -195,7 +195,7 @@ ], "matchCurrentValue": "/^\\d+\\.\\d+-\\d+\\.\\d+\\.\\d+(-jdk\\d+\\.\\d+\\.\\d+)?$/", "versioning": "regex:^(?\\d+\\.\\d+)-(?\\d+)\\.(?\\d+)\\.(?\\d+)(?:-jdk(?\\d+)\\.\\d+\\.(?\\d+))?$", - "description": "Tag format is -[-jdk], e.g. 2.13-3.9.1 or 2.13-3.9.2-jdk21.0.11 (the latter shape shipped starting with the 3.9.2 release tag). Verified live against ghcr.io: default docker versioning parses currentVersion as just '2.13' and silently drops everything after the first hyphen, so Renovate can never see a real 3.9.1->3.9.2 bump (only digest-pin updates fire, via the docker pinDigests rule below) - this affects every '# renovate:' annotated occurrence of this image. Pinning the scala prefix as 'compatibility' (never auto-changed) and parsing the kafka release as major.minor.patch fixes real version comparison. The optional '-jdk..' suffix maps jdk major to 'build' and jdk update to 'revision' (Renovate's regex versioning caps out at 5 numeric levels: major/minor/patch/build/revision, each required to be purely numeric, so the always-0 jdk interim segment is matched but not captured); tags without the suffix default build/revision to 0 and still compare correctly against suffixed ones since a differing kafka patch alone already resolves ordering. This does NOT gate jdk-major jumps (e.g. jdk21.x -> jdk25.x) the way 'compatibility' gates scala - that's covered by the same operator-side migration as the apache/kafka 4.x bump below (see docker/kafka/Dockerfile's java_version comment); revisit if jdk25 lands before that migration." + "description": "Tag format is -[-jdk], e.g. 2.13-3.9.2-jdk21.0.11 or 2.13-4.0.2. Pinning the scala prefix as compatibility and parsing the Kafka release as major.minor.patch permits real Kafka version comparisons. The optional JDK suffix maps its major version to build and update to revision. JDK major upgrades require separate validation; the Kafka 4.0.2 image retains Java 21." }, { "groupName": "kafka docker images (major)", From f71d027b31750e5899c1abebdfe3545d4038119d Mon Sep 17 00:00:00 2001 From: Cameron Wright Date: Tue, 10 Nov 2026 12:34:30 -0500 Subject: [PATCH 3/7] Fixing github workflow to allow for -x --- .github/workflows/publish-kafka-docker.yml | 4 ++-- docker/jmx_exporter/Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-kafka-docker.yml b/.github/workflows/publish-kafka-docker.yml index ea3e5f8ce..98a39f552 100644 --- a/.github/workflows/publish-kafka-docker.yml +++ b/.github/workflows/publish-kafka-docker.yml @@ -58,8 +58,8 @@ jobs: IMAGE_VERSION: ${{ steps.kafka_version.outputs.kafka_version }} run: | set -euo pipefail - if [[ ! "$IMAGE_VERSION" =~ ^([0-9]+\.[0-9]+)-([0-9]+\.[0-9]+\.[0-9]+)(-jdk[0-9]+\.[0-9]+\.[0-9]+)?$ ]]; then - echo "::error::Expected kafka--[-jdk] release tag" + if [[ ! "$IMAGE_VERSION" =~ ^([0-9]+\.[0-9]+)-([0-9]+\.[0-9]+\.[0-9]+)(-rc[0-9]+)?(-jdk[0-9]+\.[0-9]+\.[0-9]+)?$ ]]; then + echo "::error::Expected kafka--[-rc][-jdk] release tag" exit 1 fi TAG_SCALA="${BASH_REMATCH[1]}" diff --git a/docker/jmx_exporter/Dockerfile b/docker/jmx_exporter/Dockerfile index f77cff91f..10a3d18c7 100644 --- a/docker/jmx_exporter/Dockerfile +++ b/docker/jmx_exporter/Dockerfile @@ -1,6 +1,7 @@ ARG JMX_EXPORTER_VERSION=1.7.0 # renovate: datasource=github-releases depName=prometheus/jmx_exporter -FROM maven:3-amazoncorretto-21@sha256:f64fd4f0363c918004816d83d2589495b622a8d2fc5c5602c135cb4124c7ea12 AS build +# The Java agent JAR is architecture-independent; compile and test without QEMU. +FROM --platform=$BUILDPLATFORM maven:3-amazoncorretto-21@sha256:f64fd4f0363c918004816d83d2589495b622a8d2fc5c5602c135cb4124c7ea12 AS build ARG JMX_EXPORTER_VERSION # Install wget to download the release tarball From 7d6078b68a238402e18dc035cbb2ee2f10450c69 Mon Sep 17 00:00:00 2001 From: Cameron Wright Date: Tue, 10 Nov 2026 16:15:54 -0500 Subject: [PATCH 4/7] updating dockerfile to use openjdk (amazon corretto) --- docker/kafka/Dockerfile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/docker/kafka/Dockerfile b/docker/kafka/Dockerfile index 54930cd74..12701153e 100644 --- a/docker/kafka/Dockerfile +++ b/docker/kafka/Dockerfile @@ -18,9 +18,12 @@ WORKDIR /var/tmp # Download, verify, extract and clean up Kafka in single layer RUN apk add --no-cache gnupg wget && \ - wget -q $kafka_distro_base_url/$KAFKA_VERSION/$kafka_distro && \ - wget -q $kafka_distro_base_url/$KAFKA_VERSION/$kafka_distro_asc && \ - wget -q $kafka_distro_base_url/KEYS && \ + wget --timeout=30 --tries=3 --progress=dot:mega \ + "$kafka_distro_base_url/$KAFKA_VERSION/$kafka_distro" && \ + wget --timeout=30 --tries=3 --progress=dot:mega \ + "$kafka_distro_base_url/$KAFKA_VERSION/$kafka_distro_asc" && \ + wget --timeout=30 --tries=3 --progress=dot:mega \ + "$kafka_distro_base_url/KEYS" && \ gpg --import KEYS && \ gpg --verify $kafka_distro_asc $kafka_distro && \ tar -xzf $kafka_distro && \ @@ -59,12 +62,12 @@ RUN set -eux; \ arch="$(dpkg --print-architecture)"; \ case "$arch" in \ 'amd64') \ - downloadUrl="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-x64_bin.tar.gz"; \ - downloadSha256="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-x64_bin.tar.gz.sha256"; \ + downloadUrl="https://corretto.aws/downloads/latest/amazon-corretto-${java_version}-x64-linux-jdk.tar.gz"; \ + downloadSha256="https://corretto.aws/downloads/latest_sha256/amazon-corretto-${java_version}-x64-linux-jdk.tar.gz"; \ ;; \ 'arm64') \ - downloadUrl="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-aarch64_bin.tar.gz"; \ - downloadSha256="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-aarch64_bin.tar.gz.sha256"; \ + downloadUrl="https://corretto.aws/downloads/latest/amazon-corretto-${java_version}-aarch64-linux-jdk.tar.gz"; \ + downloadSha256="https://corretto.aws/downloads/latest_sha256/amazon-corretto-${java_version}-aarch64-linux-jdk.tar.gz"; \ ;; \ *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ esac; \ @@ -77,7 +80,7 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/*; \ \ wget --progress=dot:giga -O openjdk.tgz "$downloadUrl"; \ - SHA256=$(wget -qO- $downloadSha256) ; \ + SHA256="$(wget -qO- "$downloadSha256")"; \ echo "$SHA256 *openjdk.tgz" | sha256sum --strict --check -; \ \ mkdir -p "$JAVA_HOME"; \ @@ -148,9 +151,9 @@ RUN chmod a+x ${KAFKA_HOME}/bin/*.sh && \ # Add metadata labels LABEL org.opencontainers.image.title="Apache Kafka" -LABEL org.opencontainers.image.description="Apache Kafka with Oracle JDK ${java_version}" +LABEL org.opencontainers.image.description="Apache Kafka with Amazon Corretto ${java_version} (OpenJDK)" LABEL org.opencontainers.image.vendor="Adobe" -LABEL org.opencontainers.image.licenses="Apache-2.0" +LABEL org.opencontainers.image.licenses="Apache-2.0 AND GPL-2.0-only WITH Classpath-exception-2.0" LABEL org.opencontainers.image.source="https://github.com/adobe/koperator" LABEL org.opencontainers.image.documentation="https://github.com/adobe/koperator/blob/main/docker/kafka/README.md" LABEL org.opencontainers.image.version="${VERSION}" From daa7d3cd6fe6edc561c5c1a29ea9baca3e476a20 Mon Sep 17 00:00:00 2001 From: Cameron Wright Date: Mon, 16 Nov 2026 15:55:19 -0500 Subject: [PATCH 5/7] updating to use kafka 4.2 and going back to oracle for kafka jdk --- docker/jmx_exporter/Dockerfile | 9 +++++---- docker/kafka/Dockerfile | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docker/jmx_exporter/Dockerfile b/docker/jmx_exporter/Dockerfile index 10a3d18c7..b4080ea6a 100644 --- a/docker/jmx_exporter/Dockerfile +++ b/docker/jmx_exporter/Dockerfile @@ -1,11 +1,11 @@ ARG JMX_EXPORTER_VERSION=1.7.0 # renovate: datasource=github-releases depName=prometheus/jmx_exporter - +ARG BUILDPLATFORM # The Java agent JAR is architecture-independent; compile and test without QEMU. -FROM --platform=$BUILDPLATFORM maven:3-amazoncorretto-21@sha256:f64fd4f0363c918004816d83d2589495b622a8d2fc5c5602c135cb4124c7ea12 AS build +FROM --platform=$BUILDPLATFORM maven:3-amazoncorretto-25@sha256:d96c6ff2e7a3258e6f0c447340d2284a3404917bb8c5f01c8660cc4066bd382c AS build ARG JMX_EXPORTER_VERSION -# Install wget to download the release tarball -RUN yum install -y wget && yum clean all +# The Java 25 builder does not include tar or gzip. +RUN yum install -y wget tar gzip && yum clean all # Download and extract the JMX exporter release RUN wget https://github.com/prometheus/jmx_exporter/archive/refs/tags/${JMX_EXPORTER_VERSION}.tar.gz \ @@ -15,6 +15,7 @@ RUN wget https://github.com/prometheus/jmx_exporter/archive/refs/tags/${JMX_EXPO rm /tmp/jmx_exporter.tar.gz WORKDIR /src +# Keep the agent compatible with Java 21 consumers while building with JDK 25. RUN mvn -B -Dmaven.javadoc.skip=true -Dskip.javadoc=true \ -Dmaven.compiler.source=21 -Dmaven.compiler.target=21 -Dmaven.compiler.release=21 \ clean package -pl jmx_prometheus_javaagent -am && \ diff --git a/docker/kafka/Dockerfile b/docker/kafka/Dockerfile index 12701153e..b35f2ab95 100644 --- a/docker/kafka/Dockerfile +++ b/docker/kafka/Dockerfile @@ -1,7 +1,7 @@ ARG scala_version=2.13 # Kafka 4 is KRaft-only. -ARG KAFKA_VERSION=4.0.2 # renovate: datasource=github-tags depName=apache/kafka -ARG java_version=21 +ARG KAFKA_VERSION=4.2.2 # renovate: datasource=github-tags depName=apache/kafka +ARG java_version=25 FROM alpine:latest@sha256:be2656061b536c1883c4034790e21d0a09c5aaaf51968b89368a3c0371ea2c9a AS kafka_dist @@ -57,17 +57,20 @@ ENV PATH=$JAVA_HOME/bin:$PATH ENV LANG=C.UTF-8 ENV JAVA_VERSION=${java_version} +# Match the Java 25 branch defaults before generating the CDS archive. +ENV JDK_JAVA_OPTIONS="--enable-native-access=ALL-UNNAMED --illegal-native-access=deny -XX:+UseCompactObjectHeaders" + RUN set -eux; \ \ arch="$(dpkg --print-architecture)"; \ case "$arch" in \ 'amd64') \ - downloadUrl="https://corretto.aws/downloads/latest/amazon-corretto-${java_version}-x64-linux-jdk.tar.gz"; \ - downloadSha256="https://corretto.aws/downloads/latest_sha256/amazon-corretto-${java_version}-x64-linux-jdk.tar.gz"; \ + downloadUrl="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-x64_bin.tar.gz"; \ + downloadSha256="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-x64_bin.tar.gz.sha256"; \ ;; \ 'arm64') \ - downloadUrl="https://corretto.aws/downloads/latest/amazon-corretto-${java_version}-aarch64-linux-jdk.tar.gz"; \ - downloadSha256="https://corretto.aws/downloads/latest_sha256/amazon-corretto-${java_version}-aarch64-linux-jdk.tar.gz"; \ + downloadUrl="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-aarch64_bin.tar.gz"; \ + downloadSha256="https://download.oracle.com/java/${java_version}/latest/jdk-${java_version}_linux-aarch64_bin.tar.gz.sha256"; \ ;; \ *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ esac; \ @@ -151,9 +154,9 @@ RUN chmod a+x ${KAFKA_HOME}/bin/*.sh && \ # Add metadata labels LABEL org.opencontainers.image.title="Apache Kafka" -LABEL org.opencontainers.image.description="Apache Kafka with Amazon Corretto ${java_version} (OpenJDK)" +LABEL org.opencontainers.image.description="Apache Kafka with Oracle JDK ${java_version}" LABEL org.opencontainers.image.vendor="Adobe" -LABEL org.opencontainers.image.licenses="Apache-2.0 AND GPL-2.0-only WITH Classpath-exception-2.0" +LABEL org.opencontainers.image.licenses="Apache-2.0 AND LicenseRef-Oracle-NFTC" LABEL org.opencontainers.image.source="https://github.com/adobe/koperator" LABEL org.opencontainers.image.documentation="https://github.com/adobe/koperator/blob/main/docker/kafka/README.md" LABEL org.opencontainers.image.version="${VERSION}" From 31d6a32e7ed64778b809bbf05d1fe8ce00d6d180 Mon Sep 17 00:00:00 2001 From: Cameron Wright Date: Tue, 17 Nov 2026 14:51:23 -0500 Subject: [PATCH 6/7] Updating renovate to see newest version --- renovate.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/renovate.json b/renovate.json index 78dbf33d0..326faf698 100644 --- a/renovate.json +++ b/renovate.json @@ -171,8 +171,8 @@ "matchPackageNames": [ "apache/kafka" ], - "allowedVersions": ">=4.0.2 <4.1.0", - "description": "Kafka 4.0.2 is the OR2 dev upgrade target. Keep distribution updates on the 4.0 line; later minor/major versions require separate validation." + "allowedVersions": ">=4.2.2 <4.3.0", + "description": "Keep distribution updates on the 4.2 line; later minor/major versions require separate validation." }, { "matchCurrentValue": "/^\\d+\\.\\d+\\.\\d+-ado?be-\\d+$/", @@ -195,7 +195,7 @@ ], "matchCurrentValue": "/^\\d+\\.\\d+-\\d+\\.\\d+\\.\\d+(-jdk\\d+\\.\\d+\\.\\d+)?$/", "versioning": "regex:^(?\\d+\\.\\d+)-(?\\d+)\\.(?\\d+)\\.(?\\d+)(?:-jdk(?\\d+)\\.\\d+\\.(?\\d+))?$", - "description": "Tag format is -[-jdk], e.g. 2.13-3.9.2-jdk21.0.11 or 2.13-4.0.2. Pinning the scala prefix as compatibility and parsing the Kafka release as major.minor.patch permits real Kafka version comparisons. The optional JDK suffix maps its major version to build and update to revision. JDK major upgrades require separate validation; the Kafka 4.0.2 image retains Java 21." + "description": "Tag format is -[-jdk], e.g. 2.13-3.9.2-jdk21.0.11 or 2.13-4.2.2. Pinning the scala prefix as compatibility and parsing the Kafka release as major.minor.patch permits real Kafka version comparisons. The optional JDK suffix maps its major version to build and update to revision. The Kafka 4.2.2 candidate uses Oracle Java 25; keep published Java 21 defaults until replacement images are published and validated." }, { "groupName": "kafka docker images (major)", From bf94fc65963e5e2141ded646b5a7db891ba0bde1 Mon Sep 17 00:00:00 2001 From: Cameron Wright Date: Thu, 19 Nov 2026 09:48:30 -0500 Subject: [PATCH 7/7] fixing publish-kafka-docker.yml --- .github/workflows/publish-kafka-docker.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-kafka-docker.yml b/.github/workflows/publish-kafka-docker.yml index dc3453172..7b6d2fd54 100644 --- a/.github/workflows/publish-kafka-docker.yml +++ b/.github/workflows/publish-kafka-docker.yml @@ -146,14 +146,15 @@ jobs: id: jmx_exporter_version run: | JMX_VERSION=$(grep "ARG JMX_EXPORTER_VERSION=" docker/jmx_exporter/Dockerfile | cut -d'=' -f2 | cut -d' ' -f1) - # Strip a leading "v" so the published image tag is always version-only, - # regardless of whether the upstream release tag (and thus the Dockerfile ARG) has one. + # Normalize the upstream version before adding the JDK rebuild suffix. JMX_VERSION="${JMX_VERSION#v}" + JAVA_VERSION=$(sed -nE 's/^ARG java_version=([0-9]+).*$/\1/p' docker/kafka/Dockerfile) echo "jmx_version=$JMX_VERSION" >> $GITHUB_OUTPUT + echo "jmx_image_tag=${JMX_VERSION}-jdk${JAVA_VERSION}" >> $GITHUB_OUTPUT - name: Check if JMX exporter image already exists id: image_exists run: | - IMAGE_NAME="${{ env.GHCR_REGISTRY }}/${{ env.GHCR_JMX_IMAGE_NAME }}:${{ steps.jmx_exporter_version.outputs.jmx_version }}" + IMAGE_NAME="${{ env.GHCR_REGISTRY }}/${{ env.GHCR_JMX_IMAGE_NAME }}:${{ steps.jmx_exporter_version.outputs.jmx_image_tag }}" echo "Checking if image exists: $IMAGE_NAME" # Try to inspect the manifest using docker @@ -179,7 +180,7 @@ jobs: images: | ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_JMX_IMAGE_NAME }} tags: | - type=raw,value=${{ steps.jmx_exporter_version.outputs.jmx_version }} + type=raw,value=${{ steps.jmx_exporter_version.outputs.jmx_image_tag }} labels: | org.opencontainers.image.description=Prometheus JMX Exporter for Kafka monitoring - name: Build and push JMX exporter image