Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/19717#discussion_r155041617
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -2744,6 +2744,25 @@ private[spark] object Utils extends Logging {
}
}
+ /**
+ * Check the validity of the given Kubernetes master URL and return the
resolved URL.
+ */
+ def checkAndGetK8sMasterUrl(rawMasterURL: String): String = {
+ require(rawMasterURL.startsWith("k8s://"),
+ "Kubernetes master URL must start with k8s://.")
+ val masterWithoutK8sPrefix = rawMasterURL.substring("k8s://".length)
--- End diff --
Are those URIs set in stone? This seems more readable to me:
```
scala> new URI("k8s:http://foo:1234")
res0: java.net.URI = k8s:http://foo:1234
scala> res0.getScheme
res1: String = k8s
scala> res0.getSchemeSpecificPart
res2: String = http://foo:1234
```
It also allows parsing using the `URI` APIs instead of doing string
manipulation.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]