From a244db39cc1a99cf7031598024da023d05af574d Mon Sep 17 00:00:00 2001 From: mcheah Date: Thu, 5 Oct 2017 17:30:33 -0700 Subject: [PATCH 01/10] Use a pre-installed Minikube instance for integration tests. This changes the integration test workflow to assume that Minikube is already installed on the testing machine. Previously, the integration tests downloaded Minikube in the build cycle, and started/stopped the Minikube VM on every test execution. However, this made it such that multiple integration tests cannot run concurrently. This commit allows multiple tests to share a single Minikube instance, and also requires users that run integration tests to have Minikube pre-installed. If the minikube instance has enough resources, multiple tests can run against it at the same time. Each test needs to use its own set of Docker images, so the docker image builder now tags images uniquely on every test execution. --- resource-managers/kubernetes/README.md | 6 +- .../org/apache/spark/deploy/k8s/config.scala | 3 + .../kubernetes/integration-tests/pom.xml | 31 -------- .../k8s/integrationtest/KubernetesSuite.scala | 62 ++++++++-------- .../ResourceStagingServerLauncher.scala | 5 +- .../StaticAssetServerLauncher.scala | 5 +- .../backend/GCE/GCETestBackend.scala | 7 +- .../backend/IntegrationTestBackend.scala | 6 +- .../backend/minikube/Minikube.scala | 45 ++---------- .../minikube/MinikubeTestBackend.scala | 39 +++++++---- .../k8s/integrationtest/constants.scala | 22 ------ ...er.scala => SparkDockerImageManager.scala} | 70 +++++++++++++++---- 12 files changed, 140 insertions(+), 161 deletions(-) delete mode 100644 resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/constants.scala rename resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/docker/{SparkDockerImageBuilder.scala => SparkDockerImageManager.scala} (66%) diff --git a/resource-managers/kubernetes/README.md b/resource-managers/kubernetes/README.md index 31b721d193362..b726b2509433d 100644 --- a/resource-managers/kubernetes/README.md +++ b/resource-managers/kubernetes/README.md @@ -42,10 +42,12 @@ Below is a list of the submodules for this cluster manager and what they do. # Running the Kubernetes Integration Tests -Note that the integration test framework is currently being heavily revised and is subject to change. - Note that currently the integration tests only run with Java 8. +Integration tests firstly require installing [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube/) on +your machine. Refer to the Minikube documentation for instructions on how to install it. It is recommended to allocate at +least 88 CPUs and 8GB of memory to the Minikube cluster. + Running any of the integration tests requires including `kubernetes-integration-tests` profile in the build command. In order to prepare the environment for running the integration tests, the `pre-integration-test` step must be run in Maven on the `resource-managers/kubernetes/integration-tests` module: diff --git a/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/config.scala b/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/config.scala index fc08c0ad42f82..cbae0703be3d2 100644 --- a/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/config.scala +++ b/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/config.scala @@ -502,6 +502,9 @@ package object config extends Logging { private[spark] val KUBERNETES_NODE_SELECTOR_PREFIX = "spark.kubernetes.node.selector." + private[spark] val KUBERNETES_TEST_DOCKER_TAG_SYSTEM_PROPERTY = + "spark.kubernetes.test.imageDockerTag" + private[spark] def resolveK8sMaster(rawMasterString: String): String = { if (!rawMasterString.startsWith("k8s://")) { throw new IllegalArgumentException("Master URL should start with k8s:// in Kubernetes mode.") diff --git a/resource-managers/kubernetes/integration-tests/pom.xml b/resource-managers/kubernetes/integration-tests/pom.xml index d95f2f68db58f..3d50bdaad5696 100644 --- a/resource-managers/kubernetes/integration-tests/pom.xml +++ b/resource-managers/kubernetes/integration-tests/pom.xml @@ -324,37 +324,6 @@ - - com.googlecode.maven-download-plugin - download-maven-plugin - 1.3.0 - - - download-minikube-linux - pre-integration-test - - wget - - - https://storage.googleapis.com/minikube/releases/v0.16.0/minikube-linux-amd64 - ${project.build.directory}/minikube-bin/linux-amd64 - minikube - - - - download-minikube-darwin - pre-integration-test - - wget - - - https://storage.googleapis.com/minikube/releases/v0.16.0/minikube-darwin-amd64 - ${project.build.directory}/minikube-bin/darwin-amd64 - minikube - - - -