-
Notifications
You must be signed in to change notification settings - Fork 28.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Gummelt
committed
Apr 21, 2017
1 parent
810c6b2
commit ad4e33b
Showing
8 changed files
with
62 additions
and
55 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...in/resources/META-INF/services/org.apache.spark.deploy.security.ServiceCredentialProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
org.apache.spark.deploy.security.HadoopFSCredentialProvider | ||
org.apache.spark.deploy.security.HBaseCredentialProvider | ||
org.apache.spark.deploy.security.HiveCredentialProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...sources/META-INF/services/org.apache.spark.deploy.yarn.security.ServiceCredentialProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.apache.spark.deploy.yarn.security.YARNTestCredentialProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,53 +18,32 @@ | |
package org.apache.spark.deploy.yarn.security | ||
|
||
import org.apache.hadoop.conf.Configuration | ||
import org.scalatest.{Matchers, PrivateMethodTester} | ||
import org.scalatest.Matchers | ||
|
||
import org.apache.spark.{SparkException, SparkFunSuite} | ||
import org.apache.spark.deploy.yarn.security.YARNHadoopAccessManager | ||
import org.apache.spark.{SparkConf, SparkException, SparkFunSuite} | ||
|
||
class YARNHadoopFSCredentialProviderSuite | ||
extends SparkFunSuite | ||
with PrivateMethodTester | ||
with Matchers { | ||
private val _getTokenRenewer = PrivateMethod[String]('getTokenRenewer) | ||
|
||
private def getTokenRenewer( | ||
fsCredentialProvider: YARNHadoopAccessManager, conf: Configuration): String = { | ||
fsCredentialProvider invokePrivate _getTokenRenewer(conf) | ||
} | ||
|
||
private var hadoopFsCredentialProvider: YARNHadoopAccessManager = null | ||
|
||
override def beforeAll() { | ||
super.beforeAll() | ||
|
||
if (hadoopFsCredentialProvider == null) { | ||
hadoopFsCredentialProvider = new YARNHadoopAccessManager() | ||
} | ||
} | ||
|
||
override def afterAll() { | ||
if (hadoopFsCredentialProvider != null) { | ||
hadoopFsCredentialProvider = null | ||
} | ||
|
||
super.afterAll() | ||
} | ||
class YARNHadoopAccessManagerSuite extends SparkFunSuite with Matchers { | ||
|
||
test("check token renewer") { | ||
val hadoopConf = new Configuration() | ||
hadoopConf.set("yarn.resourcemanager.address", "myrm:8033") | ||
hadoopConf.set("yarn.resourcemanager.principal", "yarn/myrm:[email protected]") | ||
val renewer = getTokenRenewer(hadoopFsCredentialProvider, hadoopConf) | ||
|
||
val sparkConf = new SparkConf() | ||
val yarnHadoopAccessManager = new YARNHadoopAccessManager(hadoopConf, sparkConf) | ||
|
||
val renewer = yarnHadoopAccessManager.getTokenRenewer | ||
renewer should be ("yarn/myrm:[email protected]") | ||
} | ||
|
||
test("check token renewer default") { | ||
val hadoopConf = new Configuration() | ||
val sparkConf = new SparkConf() | ||
val yarnHadoopAccessManager = new YARNHadoopAccessManager(hadoopConf, sparkConf) | ||
|
||
val caught = | ||
intercept[SparkException] { | ||
getTokenRenewer(hadoopFsCredentialProvider, hadoopConf) | ||
yarnHadoopAccessManager.getTokenRenewer | ||
} | ||
assert(caught.getMessage === "Can't get Master Kerberos principal for use as renewer") | ||
} | ||
|