Github user liyinan926 commented on a diff in the pull request:
https://github.com/apache/spark/pull/19717#discussion_r155979118
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -2744,6 +2744,42 @@ private[spark] object Utils extends Logging {
}
}
+ /**
+ * Check the validity of the given Kubernetes master URL and return the
resolved URL. Prefix
+ * "k8s:" is appended to the resolved URL as the prefix is used by
KubernetesClusterManager
+ * in canCreate to determine if the KubernetesClusterManager should be
used.
+ */
+ def checkAndGetK8sMasterUrl(rawMasterURL: String): String = {
+ require(rawMasterURL.startsWith("k8s://"),
+ "Kubernetes master URL must start with k8s://.")
+ val masterWithoutK8sPrefix = rawMasterURL.substring("k8s://".length)
+
+ // To handle master URLs, e.g., k8s://host:port.
+ if (!masterWithoutK8sPrefix.contains("://")) {
--- End diff --
This is used to differentiate `https://host:port` vs. `host:port`. So
`contains` is the right method here.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]