-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-37354][K8S][TESTS] Make the Java version installed on the container image used by the K8s integration tests with SBT configurable #34628
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
Conversation
| "-t", imageTag.value, | ||
| "-p", s"$bindingsDir/python/Dockerfile", | ||
| "-R", s"$bindingsDir/R/Dockerfile", | ||
| "-b", s"java_image_tag=${sys.env.getOrElse("JAVA_IMAGE_TAG", "8-jre-slim")}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default Java version is 8 if the K8s integration tests are launched by Maven so this PR complies with that.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #145324 has finished for PR 34628 at commit
|
|
LGTM, the K8s failures seem unrelated I've got a follow up PR for the decom failure - #34636 |
|
I'll merge this as I have one LGTM from @holdenk . But I'll rebase before merge, just in case. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #145485 has finished for PR 34628 at commit
|
|
Merging to Thank you @holdenk for reviewing ! |
### What changes were proposed in this pull request? This PR aims to support K8s integration tests for Java 17 using Maven and SBT. The new system property `spark.kubernetes.test.dockerFile` is introduced to specify a Dockerfile. By setting `Dockerfile.java17` to the property, the integration tests run with Java 17. This PR also revised the change brought by SPARK-37354 (#34628) by changing `SparkBuild.scala` so that it can recognize the system property `spark.kubernetes.test.javaImageTag`, like the integration tests with Maven do. If both `spark.kubernetes.test.dockerFile` and `spark.kubernetes.test.javaImageTag` are set, `spark.kubernetes.test.dockerFile` is preferred. ### Why are the changes needed? To ensure Spark works on K8s with Java 17. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Confirmed that the intended version of Java is used for each pattern. * Neither `spark.kubernetes.test.javaImageTag` nor `spark.kubernetes.test.dockerFile` is set (SBT) ``` # Run the integration tests to create the container image $ build/sbt -Pkubernetes -Pkubernetes-integration-tests "kubernetes-integration-tests/test" # Create and login the container. docker run -it <hash> /bin/bash 185b40ef8aaa56c:/opt/spark/work-dir$ java -version openjdk version "1.8.0_312" OpenJDK Runtime Environment (build 1.8.0_312-b07) OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode) ``` * Neither `spark.kubernetes.test.javaImageTag` nor `spark.kubernetes.test.dockerFile` is set (Maven) ``` # Run the integration tests to create the container image $ build/mvn -Pkubernetes -Pkubernetes-integration-tests -pl resource-managers/kubernetes/integration-tests integration-test # Create and login the container. docker run -it <hash> /bin/bash 18536ae5c5c21f4:/opt/spark/work-dir$ java -version openjdk version "1.8.0_312" OpenJDK Runtime Environment (build 1.8.0_312-b07) OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode) ``` * `spark.kubernetes.test.javaImageTag` is set (SBT): ``` # Run the integration tests to create the container image $ build/sbt -Dspark.kubernetes.test.javaImageTag=11-jre-slim -Pkubernetes -Pkubernetes-integration-tests "kubernetes-integration-tests/test" # Create and login the container. docker run -it <hash> /bin/bash 1855b896d0e5dd8:/opt/spark/work-dir$ java -version openjdk version "11.0.13" 2021-10-19 OpenJDK Runtime Environment 18.9 (build 11.0.13+8) OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing) ``` * `spark.kubernetes.test.javaImageTag` is set (Maven): ``` # Run the integration tests to create the container image $ build/mvn -Dspark.kubernetes.test.javaImageTag=11-jre-slim -Pkubernetes -Pkubernetes-integration-tests -pl resource-managers/kubernetes/integration-tests integration-test # Create and login the container. docker run -it <hash> /bin/bash 1855d3c228e7521:/opt/spark/work-dir$ java -version openjdk version "11.0.13" 2021-10-19 OpenJDK Runtime Environment 18.9 (build 11.0.13+8) OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing) ``` * `spark.kubernetes.test.dockerFile` is set (SBT) ``` $ build/sbt -Dspark.kubernetes.test.dockerFile=resource-managers/kubernetes/docker/src/main/dockerfiles/spark/Dockerfile.java17 -Pkubernetes -Pkubernetes-integration-tests package "kubernetes-integration-tests/test" # Create and login the container. docker run -it <hash> /bin/bash 185550515c76582:/opt/spark/work-dir$ java -version openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-Debian-1deb11u2) OpenJDK 64-Bit Server VM (build 17.0.1+12-Debian-1deb11u2, mixed mode, sharing) ``` * `spark.kubernetes.test.dockerFile` is set (Maven) ``` build/mvn -Dspark.kubernetes.test.dockerFile=resource-managers/kubernetes/docker/src/main/dockerfiles/spark/Dockerfile.java17 -Pkubernetes -Pkubernetes-integration-tests -pl resource-managers/kubernetes/integration-tests integration-test # Create and login the container. docker run -it <hash> /bin/bash 185be35bde0ebfa:/opt/spark/work-dir$ java -version openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-Debian-1deb11u2) OpenJDK 64-Bit Server VM (build 17.0.1+12-Debian-1deb11u2, mixed mode, sharing) ``` * Both `spark.kubernetes.test.javaImageTag` and `spark.kubernetes.test.dockerFile` are set (SBT) ``` $ build/sbt -Dspark.kubernetes.test.dockerFile=resource-managers/kubernetes/docker/src/main/dockerfiles/spark/Dockerfile.java17 -Dspark.kubernetes.test.javaImageTag=11-jre-slim -Pkubernetes -Pkubernetes-integration-tests package "kubernetes-integration-tests/test" # Create and login the container. docker run -it <hash> /bin/bash 1857ed1891b2921:/opt/spark/work-dir$ java -version openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-Debian-1deb11u2) OpenJDK 64-Bit Server VM (build 17.0.1+12-Debian-1deb11u2, mixed mode, sharing) ``` * Both `spark.kubernetes.test.javaImageTag` and `spark.kubernetes.test.dockerFile` are set (Maven) ``` $ build/mvn -Dspark.kubernetes.test.dockerFile=resource-managers/kubernetes/docker/src/main/dockerfiles/spark/Dockerfile.java17 -Dspark.kubernetes.test.javaImageTag=11-jre-slim -Pkubernetes -Pkubernetes-integration-tests -pl resource-managers/kubernetes/integration-tests integration-test # Create and login the container. docker run -it <hash> /bin/bash 18584f3a8b7b4a6:/opt/spark/work-dir$ java -version openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-Debian-1deb11u2) OpenJDK 64-Bit Server VM (build 17.0.1+12-Debian-1deb11u2, mixed mode, sharing) ``` Closes #34790 from sarutak/kube-integration-test-java17. Authored-by: Kousuke Saruta <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
What changes were proposed in this pull request?
This PR fixes an issue that the Java version installed on the container image used by K8s integration tests are not configurable in case the tests are launched by SBT.
bin/docker-image-tool.shsupports-b java_image_tag=<java image tag>option to the Java version installed on the container image configurable.But
project/SparkBuild.scaladoesn't provide the way to pass the option so we can't change the Java version if the tests are launched by SBT.To allow to change the version, this PR changes
project/SparkBuild.scalato recognized the environment variableJAVA_IMAGE_TAG, which is the same manner thatresource-managers/kubernetes/integration-tests/scripts/setup-integration-test-env.shdoes.Why are the changes needed?
The K8s integration tests should be launched by any supported Java versions.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Confirmed that the Java version installed on the container image.
In case
JAVA_IMAGE_TAGis not set:In case
JAVA_IMAGE_TAGis set: