Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import com.google.common.base.Charsets
import com.google.common.io.Files
import io.fabric8.kubernetes.client.{Config, ConfigBuilder, DefaultKubernetesClient}

import org.apache.spark.deploy.kubernetes.constants._

private[spark] object KubernetesClientBuilder {
private val API_SERVER_TOKEN = new File(Config.KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH)
private val CA_CERT_FILE = new File(Config.KUBERNETES_SERVICE_ACCOUNT_CA_CRT_PATH)
Expand All @@ -33,11 +35,10 @@ private[spark] object KubernetesClientBuilder {
* into the pod's disk space.
*/
def buildFromWithinPod(
kubernetesMaster: String,
kubernetesNamespace: String): DefaultKubernetesClient = {
var clientConfigBuilder = new ConfigBuilder()
.withApiVersion("v1")
.withMasterUrl(kubernetesMaster)
.withMasterUrl(KUBERNETES_MASTER_INTERNAL_URL)
.withNamespace(kubernetesNamespace)

if (CA_CERT_FILE.isFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ package object constants {
// Miscellaneous
private[spark] val DRIVER_CONTAINER_NAME = "spark-kubernetes-driver"
private[spark] val KUBERNETES_SUBMIT_SSL_NAMESPACE = "kubernetes.submit"
private[spark] val KUBERNETES_MASTER_INTERNAL_URL = "https://kubernetes.default.svc"
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ private[spark] class KubernetesClusterSchedulerBackend(
private val EXECUTOR_MODIFICATION_LOCK = new Object
private val runningExecutorPods = new scala.collection.mutable.HashMap[String, Pod]

private val kubernetesMaster = "https://kubernetes"
private val executorDockerImage = conf.get(EXECUTOR_DOCKER_IMAGE)
private val kubernetesNamespace = conf.get(KUBERNETES_NAMESPACE)
private val executorPort = conf.getInt("spark.executor.port", DEFAULT_STATIC_PORT)
Expand Down Expand Up @@ -77,7 +76,7 @@ private[spark] class KubernetesClusterSchedulerBackend(
ThreadUtils.newDaemonCachedThreadPool("kubernetes-executor-requests"))

private val kubernetesClient = KubernetesClientBuilder
.buildFromWithinPod(kubernetesMaster, kubernetesNamespace)
.buildFromWithinPod(kubernetesNamespace)

private val driverPod = try {
kubernetesClient.pods().inNamespace(kubernetesNamespace).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private[spark] object Minikube extends Logging {

def getDockerEnv: Map[String, String] = synchronized {
assert(MINIKUBE_EXECUTABLE_DEST.exists(), EXPECTED_DOWNLOADED_MINIKUBE_MESSAGE)
executeMinikube("docker-env")
executeMinikube("docker-env", "--shell", "bash")
Copy link
Member Author

Choose a reason for hiding this comment

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

Also added this because I switched to a different shell and it was giving me odd errors because our string replacement relies on bash style output

.filter(_.startsWith("export"))
.map(_.replaceFirst("export ", "").split('='))
.map(arr => (arr(0), arr(1).replaceAllLiterally("\"", "")))
Expand Down