Skip to content

Commit 844642e

Browse files
ekrivokonmaprmgorbov
authored andcommitted
MapR [SPARK-143] Spark History Server does not require login for secured-by-default clusters (apache#239)
1 parent bc6afee commit 844642e

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

bin/configure.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ spark.ssl.keyStorePassword mapr123
220220
spark.ssl.protocol TLSv1.2
221221
222222
# - PAM
223-
spark.ui.filters org.apache.spark.ui.filters.PAMWebUIFilter
223+
spark.ui.filters org.apache.spark.deploy.yarn.YarnProxyRedirectFilter, org.apache.spark.ui.filters.PAMWebUIFilter
224224
225225
# - ACLS
226226
spark.acls.enable true

resource-managers/yarn/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,23 @@ private[spark] abstract class YarnSchedulerBackend(
161161
filterName: String,
162162
filterParams: Map[String, String],
163163
proxyBase: String): Unit = {
164-
if (proxyBase != null && proxyBase.nonEmpty) {
165-
System.setProperty("spark.ui.proxyBase", proxyBase)
166-
}
164+
val amIpFilter = "org.apache.hadoop.yarn.server.webproxy.amfilter.AmIpFilter"
165+
166+
if (filterName != amIpFilter) {
167+
if (proxyBase != null &&
168+
proxyBase.nonEmpty) {
169+
System.setProperty("spark.ui.proxyBase", proxyBase)
170+
}
167171

168-
val hasFilter =
169-
filterName != null && filterName.nonEmpty &&
170-
filterParams != null && filterParams.nonEmpty
171-
if (hasFilter) {
172-
logInfo(s"Add WebUI Filter. $filterName, $filterParams, $proxyBase")
173-
conf.set("spark.ui.filters", filterName)
174-
filterParams.foreach { case (k, v) => conf.set(s"spark.$filterName.param.$k", v) }
175-
scheduler.sc.ui.foreach { ui => JettyUtils.addFilters(ui.getHandlers, conf) }
172+
val hasFilter =
173+
filterName != null && filterName.nonEmpty &&
174+
filterParams != null && filterParams.nonEmpty
175+
if (hasFilter) {
176+
logInfo(s"Add WebUI Filter. $filterName, $filterParams, $proxyBase")
177+
conf.set("spark.ui.filters", filterName)
178+
filterParams.foreach { case (k, v) => conf.set(s"spark.$filterName.param.$k", v) }
179+
scheduler.sc.ui.foreach { ui => JettyUtils.addFilters(ui.getHandlers, conf) }
180+
}
176181
}
177182
}
178183

0 commit comments

Comments
 (0)