Skip to content

[kafka] Upgrade Cruise Control to 3.0.4 for Java 17 and Java 21 support - #1403

Open
jitender-goyal wants to merge 1 commit into
GoogleCloudDataproc:mainfrom
jitender-goyal:cruise-control-java21
Open

jitender-goyal wants to merge 1 commit into
GoogleCloudDataproc:mainfrom
jitender-goyal:cruise-control-java21

Conversation

@jitender-goyal

Copy link
Copy Markdown
  • Upgraded default CRUISE_CONTROL_VERSION to 3.0.4
  • Added Java 21 and Gradle 8.5 compatibility
  • Replaced hardcoded reporter jar path with wildcard cruise-control-metrics-reporter-*.jar
  • Added --add-opens JVM options to KAFKA_OPTS for runtime reflection on Java 17+
  • Preserved legacy build.gradle injection only for older 2.0.x branches

@google-cla

google-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the default Cruise Control version to 3.0.4 to support Java 17 and 21, conditionally applies legacy build patches for older versions, and adds JVM reflection options for modern Java runtimes. The review feedback suggests ensuring backward compatibility with Java 8 by conditionally applying the --add-opens JVM options, broadening the legacy version check regex to support all 2.x versions, and using a more specific file selection instead of a wildcard to avoid copying auxiliary jars to the Kafka classpath.

Comment thread kafka/cruise-control.sh Outdated
Comment thread kafka/cruise-control.sh Outdated
Comment thread kafka/cruise-control.sh Outdated
@jitender-goyal

Copy link
Copy Markdown
Author

@vinayakumarb

Comment thread kafka/cruise-control.sh Outdated
readonly ROLE="$(/usr/share/google/get_metadata_value attributes/dataproc-role)"
readonly CRUISE_CONTROL_VERSION="$(/usr/share/google/get_metadata_value attributes/cruise-control-version || echo 2.0.37)"
# Default to 3.0.4 for Java 17 and Java 21 compatibility (Gradle 8.5, Scala 2.13, Kafka 3.5+)
readonly CRUISE_CONTROL_VERSION="$(/usr/share/google/get_metadata_value attributes/cruise-control-version || echo 3.0.4)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

will this version work for older dataproc versions ?

Comment thread kafka/cruise-control.sh Outdated
reports {
xml.enabled (project.hasProperty('xmlFindBugsReport'))
html.enabled (!project.hasProperty('xmlFindBugsReport'))
xml.enabled = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

earlier this value was fetched from project.hasProperty('xmlFindBugsReport'), how do we that this value will always be false.

Comment thread kafka/cruise-control.sh
cp ${CRUISE_CONTROL_HOME}/cruise-control-metrics-reporter/build/libs/cruise-control-metrics-reporter-2.0.38-SNAPSHOT.jar \
${KAFKA_HOME}/libs
cat >>${KAFKA_CONFIG_FILE} <<EOF
find "${CRUISE_CONTROL_HOME}"/cruise-control-metrics-reporter/build/libs/ -name "cruise-control-metrics-reporter-*.jar" ! -name "*-sources.jar" ! -name "*-javadoc.jar" ! -name "*-tests.jar" -exec cp {} "${KAFKA_HOME}/libs" \;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

earlier 2.0.38 was used, is the new version working for ld dataproc versions

@jitender-goyal jitender-goyal Sep 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is backward compatible, Will pick the jar according to the cruise control version

Comment thread kafka/cruise-control.sh Outdated
echo "Start Cruise Control server on ${HOSTNAME}."
pushd ${CRUISE_CONTROL_HOME}
pushd "${CRUISE_CONTROL_HOME}"
# Ensure necessary opens for modern Java (Java 9+) runtime reflection

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is this required for older dataproc versions

- Upgraded default CRUISE_CONTROL_VERSION to 3.0.4 (Gradle 8.5, Scala 2.13, Kafka 3.5+)
- Conditionally applied legacy build patches only for older 2.x releases
- Filtered auxiliary jars (sources, javadoc, tests) when copying metrics reporter jar to Kafka classpath
- Conditionally added --add-opens JVM options to KAFKA_OPTS for Java 9+ runtimes
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.

2 participants