|
@@ -232,6 +232,7 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol {
|
|
@VisibleForTesting
|
|
@VisibleForTesting
|
|
boolean isCentralizedNodeLabelConfiguration = true;
|
|
boolean isCentralizedNodeLabelConfiguration = true;
|
|
private boolean filterAppsByUser = false;
|
|
private boolean filterAppsByUser = false;
|
|
|
|
+ private boolean enableRestAppSubmissions = true;
|
|
|
|
|
|
public final static String DELEGATION_TOKEN_HEADER =
|
|
public final static String DELEGATION_TOKEN_HEADER =
|
|
"Hadoop-YARN-RM-Delegation-Token";
|
|
"Hadoop-YARN-RM-Delegation-Token";
|
|
@@ -247,6 +248,9 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol {
|
|
this.filterAppsByUser = conf.getBoolean(
|
|
this.filterAppsByUser = conf.getBoolean(
|
|
YarnConfiguration.FILTER_ENTITY_LIST_BY_USER,
|
|
YarnConfiguration.FILTER_ENTITY_LIST_BY_USER,
|
|
YarnConfiguration.DEFAULT_DISPLAY_APPS_FOR_LOGGED_IN_USER);
|
|
YarnConfiguration.DEFAULT_DISPLAY_APPS_FOR_LOGGED_IN_USER);
|
|
|
|
+ this.enableRestAppSubmissions = conf.getBoolean(
|
|
|
|
+ YarnConfiguration.ENABLE_REST_APP_SUBMISSIONS,
|
|
|
|
+ YarnConfiguration.DEFAULT_ENABLE_REST_APP_SUBMISSIONS);
|
|
}
|
|
}
|
|
|
|
|
|
RMWebServices(ResourceManager rm, Configuration conf,
|
|
RMWebServices(ResourceManager rm, Configuration conf,
|
|
@@ -1471,6 +1475,10 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol {
|
|
@Override
|
|
@Override
|
|
public Response createNewApplication(@Context HttpServletRequest hsr)
|
|
public Response createNewApplication(@Context HttpServletRequest hsr)
|
|
throws AuthorizationException, IOException, InterruptedException {
|
|
throws AuthorizationException, IOException, InterruptedException {
|
|
|
|
+ if (!enableRestAppSubmissions) {
|
|
|
|
+ String msg = "App submission via REST is disabled.";
|
|
|
|
+ return Response.status(Status.FORBIDDEN).entity(msg).build();
|
|
|
|
+ }
|
|
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
|
|
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
|
|
initForWritableEndpoints(callerUGI, false);
|
|
initForWritableEndpoints(callerUGI, false);
|
|
|
|
|
|
@@ -1491,6 +1499,10 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol {
|
|
public Response submitApplication(ApplicationSubmissionContextInfo newApp,
|
|
public Response submitApplication(ApplicationSubmissionContextInfo newApp,
|
|
@Context HttpServletRequest hsr)
|
|
@Context HttpServletRequest hsr)
|
|
throws AuthorizationException, IOException, InterruptedException {
|
|
throws AuthorizationException, IOException, InterruptedException {
|
|
|
|
+ if (!enableRestAppSubmissions) {
|
|
|
|
+ String msg = "App submission via REST is disabled.";
|
|
|
|
+ return Response.status(Status.FORBIDDEN).entity(msg).build();
|
|
|
|
+ }
|
|
|
|
|
|
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
|
|
UserGroupInformation callerUGI = getCallerUserGroupInformation(hsr, true);
|
|
initForWritableEndpoints(callerUGI, false);
|
|
initForWritableEndpoints(callerUGI, false);
|