Skip to content

Conversation

@vanzin
Copy link
Contributor

@vanzin vanzin commented Feb 16, 2017

Allow an application to use the History Server URL as the tracking
URL in the YARN RM, so there's still a link to the web UI somewhere
in YARN even if the driver's UI is disabled. This is useful, for
example, if an admin wants to disable the driver UI by default for
applications, since it's harder to secure it (since it involves non
trivial ssl certificate and auth management that admins may not want
to expose to user apps).

This needs to be opt-in, because of the way the YARN proxy works, so
a new configuration was added to enable the option.

The YARN RM will proxy requests to live AMs instead of redirecting
the client, so pages in the SHS UI will not render correctly since
they'll reference invalid paths in the RM UI. The proxy base support
in the SHS cannot be used since that would prevent direct access to
the SHS.

So, to solve this problem, for the feature to work end-to-end, a new
YARN-specific filter was added that detects whether the requests come
from the proxy and redirects the client appropriatly. The SHS admin has
to add this filter manually if they want the feature to work.

Tested with new unit test, and by running with the documented configuration
set in a test cluster. Also verified the driver UI is used when it's
enabled.

Allow an application to use the History Server URL as the tracking
URL in the YARN RM, so there's still a link to the web UI somewhere
in YARN even if the driver's UI is disabled. This is useful, for
example, if an admin wants to disable the driver UI by default for
applications, since it's harder to secure it (since it involves non
trivial ssl certificate and auth management that admins may not want
to expose to user apps).

This needs to be opt-in, because of the way the YARN proxy works, so
a new configuration was added to enable the option.

The YARN RM will proxy requests to live AMs instead of redirecting
the client, so pages in the SHS UI will not render correctly since
they'll reference invalid paths in the RM UI. The proxy base support
in the SHS cannot be used since that would prevent direct access to
the SHS.

So, to solve this problem, for the feature to work end-to-end, a new
YARN-specific filter was added that detects whether the requests come
from the proxy and redirects the client appropriatly. The SHS admin has
to add this filter manually if they want the feature to work.

Tested with new unit test, and by running with the documented configuration
set in a test cluster. Also verified the driver UI is used when it's
enabled.
@SparkQA
Copy link

SparkQA commented Feb 16, 2017

Test build #72967 has finished for PR 16946 at commit 32b8dcd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class YarnProxyRedirectFilter extends Filter with Logging

@vanzin
Copy link
Contributor Author

vanzin commented Feb 16, 2017

@tgravescs pinging you since this is all YARN-side (doesn't really touch the UI).

@SparkQA
Copy link

SparkQA commented Feb 16, 2017

Test build #73007 has finished for PR 16946 at commit d675717.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor Author

vanzin commented Feb 21, 2017

trying to get some eyes on this: @squito

Turn the redirect handler into a servlet, and install user filters,
so that they can be applied before redirection to the HTTPS port.
This can be used, for example, to perform redirection to the SHS
from the YARN RM proxy without having to deal with trust stores
on the YARN RM config.
@tgravescs
Copy link
Contributor

On vacation back next Monday and will review.

@SparkQA
Copy link

SparkQA commented Feb 22, 2017

Test build #73242 has finished for PR 16946 at commit 5aef8eb.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

It may not be the best idea to install auth filters on the
unencrypted connector, so don't do this and require admins
to properly set up trust stores in YARN instead. We can
add this as a new feature (with security properly accounted
for) later on.
@SparkQA
Copy link

SparkQA commented Feb 22, 2017

Test build #73287 has finished for PR 16946 at commit b380a85.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Contributor

@squito squito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
very minor comments

val cookies = Array(new Cookie(YarnProxyRedirectFilter.COOKIE_NAME, "dr.who"))

val req = mock(classOf[HttpServletRequest])
when(req.getCookies()).thenReturn(cookies, null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was really confused by this test at first -- I didn't know that thenReturn lets you specify multiple values for consecutive calls. For any one else as clueless as me, it would be helpful to drop in a comment here to draw attention to this, eg. "First request has cookies with a user name, second request does not".

## Using the Spark History Server to replace the Spark Web UI

It is possible to use the Spark History Server application page as the tracking URL for running
applications in scenarios where it may be desired to disable the built-in application UI. Two steps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: first sentence reads a little funny. maybe rephrase to:

It is possible to use the Spark History Server application page as the tracking URL for running
applications where built-in application UI is disabled. This may be desirable on secure clusters or to avoid the memory usage on the driver from the UI.

Up to you. maybe doens't even need the second sentence.

@SparkQA
Copy link

SparkQA commented Feb 22, 2017

Test build #73296 has finished for PR 16946 at commit e0df6a5.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor Author

vanzin commented Feb 22, 2017

Merging to master.

@tgravescs we can address any feedback you might have when you're back.

@asfgit asfgit closed this in 4661d30 Feb 22, 2017
@vanzin vanzin deleted the SPARK-19554 branch February 22, 2017 22:41
Yunni pushed a commit to Yunni/spark that referenced this pull request Feb 27, 2017
Allow an application to use the History Server URL as the tracking
URL in the YARN RM, so there's still a link to the web UI somewhere
in YARN even if the driver's UI is disabled. This is useful, for
example, if an admin wants to disable the driver UI by default for
applications, since it's harder to secure it (since it involves non
trivial ssl certificate and auth management that admins may not want
to expose to user apps).

This needs to be opt-in, because of the way the YARN proxy works, so
a new configuration was added to enable the option.

The YARN RM will proxy requests to live AMs instead of redirecting
the client, so pages in the SHS UI will not render correctly since
they'll reference invalid paths in the RM UI. The proxy base support
in the SHS cannot be used since that would prevent direct access to
the SHS.

So, to solve this problem, for the feature to work end-to-end, a new
YARN-specific filter was added that detects whether the requests come
from the proxy and redirects the client appropriatly. The SHS admin has
to add this filter manually if they want the feature to work.

Tested with new unit test, and by running with the documented configuration
set in a test cluster. Also verified the driver UI is used when it's
enabled.

Author: Marcelo Vanzin <[email protected]>

Closes apache#16946 from vanzin/SPARK-19554.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants