Skip to content

Commit

Permalink
Filter nodes to only try and send files to external IPs (#106)
Browse files Browse the repository at this point in the history
* Filter node addresses

* Added comment
  • Loading branch information
foxish authored and ash211 committed Feb 16, 2017
1 parent f2dbdd5 commit 94c1a11
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,14 @@ private[spark] class Client(
val nodeUrls = kubernetesClient.nodes.list.getItems.asScala
.filterNot(node => node.getSpec.getUnschedulable != null &&
node.getSpec.getUnschedulable)
.flatMap(_.getStatus.getAddresses.asScala.map(address => {
.flatMap(_.getStatus.getAddresses.asScala)
// The list contains hostnames, internal and external IP addresses.
// we want only external IP addresses in our list
// (https://kubernetes.io/docs/admin/node/#addresses)
.filter(_.getType == "ExternalIP")
.map(address => {
s"$urlScheme://${address.getAddress}:$servicePort"
})).toSet
}).toSet
require(nodeUrls.nonEmpty, "No nodes found to contact the driver!")
val (trustManager, sslContext): (X509TrustManager, SSLContext) =
if (driverSubmitSslOptions.enabled) {
Expand Down

0 comments on commit 94c1a11

Please sign in to comment.