This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 12f8cad  [SPARK-38071][K8S][TESTS] Support K8s namespace parameter in 
SBT K8s IT
12f8cad is described below

commit 12f8cadf3b85cf4f4cde80bdc7cdb50d5312f6bf
Author: William Hyun <[email protected]>
AuthorDate: Sat Jan 29 20:26:54 2022 -0800

    [SPARK-38071][K8S][TESTS] Support K8s namespace parameter in SBT K8s IT
    
    ### What changes were proposed in this pull request?
    This PR aims to support K8s namespace parameter in SBT K8s integration test.
    
    ### Why are the changes needed?
    - This allows the users to set the test namespace name
    - When there is no given namespace, it will generate a random namespace and 
use it like `Maven` test
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Manually using the following command
    ```
    build/sbt -Psparkr -Pkubernetes -Pkubernetes-integration-tests 
-Dtest.exclude.tags=minikube 
-Dspark.kubernetes.test.deployMode=docker-for-desktop 
-Dspark.kubernetes.test.namespace=spark-it-test 
"kubernetes-integration-tests/test"
    ```
    
    Closes #35364 from williamhyun/sbtnamespace.
    
    Authored-by: William Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
    (cherry picked from commit 71c34b42f392be78d8e40749e3e23c9ec58e6718)
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 project/SparkBuild.scala | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index 39b7d18..63cee78 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -615,7 +615,7 @@ object KubernetesIntegrationTests {
   val dockerBuild = TaskKey[Unit]("docker-imgs", "Build the docker images for 
ITs.")
   val runITs = TaskKey[Unit]("run-its", "Only run ITs, skip image build.")
   val imageTag = settingKey[String]("Tag to use for images built during the 
test.")
-  val namespace = settingKey[String]("Namespace where to run pods.")
+  val namespace = sys.props.get("spark.kubernetes.test.namespace")
   val deployMode = sys.props.get("spark.kubernetes.test.deployMode")
 
   // Hack: this variable is used to control whether to build docker images. 
It's updated by
@@ -625,7 +625,6 @@ object KubernetesIntegrationTests {
 
   lazy val settings = Seq(
     imageTag := "dev",
-    namespace := "default",
     dockerBuild := {
       if (shouldBuildImage) {
         val dockerTool = s"$sparkHome/bin/docker-image-tool.sh"
@@ -653,9 +652,9 @@ object KubernetesIntegrationTests {
     (Test / javaOptions) ++= Seq(
       
s"-Dspark.kubernetes.test.deployMode=${deployMode.getOrElse("minikube")}",
       s"-Dspark.kubernetes.test.imageTag=${imageTag.value}",
-      s"-Dspark.kubernetes.test.namespace=${namespace.value}",
       s"-Dspark.kubernetes.test.unpackSparkDir=$sparkHome"
     ),
+    (Test / javaOptions) ++= 
namespace.map("-Dspark.kubernetes.test.namespace=" + _),
     // Force packaging before building images, so that the latest code is 
tested.
     dockerBuild := dockerBuild
       .dependsOn(assembly / Compile / packageBin)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to