YARN-11434. [Router] UGI conf doesn't read user overridden configurations on Router startup. (#6011) Contributed by Shilun Fan.
Reviewed-by: Inigo Goiri <inigoiri@apache.org> Signed-off-by: Shilun Fan <slfan1989@apache.org>
This commit is contained in:
parent
9342ecf6cc
commit
3ab983fbae
@ -35,6 +35,7 @@
|
|||||||
import org.apache.hadoop.security.AuthenticationFilterInitializer;
|
import org.apache.hadoop.security.AuthenticationFilterInitializer;
|
||||||
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
|
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
|
||||||
import org.apache.hadoop.security.SecurityUtil;
|
import org.apache.hadoop.security.SecurityUtil;
|
||||||
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.service.CompositeService;
|
import org.apache.hadoop.service.CompositeService;
|
||||||
import org.apache.hadoop.util.JvmPauseMonitor;
|
import org.apache.hadoop.util.JvmPauseMonitor;
|
||||||
import org.apache.hadoop.util.ShutdownHookManager;
|
import org.apache.hadoop.util.ShutdownHookManager;
|
||||||
@ -111,6 +112,7 @@ protected void initAndStart(Configuration conf, boolean hasToReboot) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void serviceInit(Configuration conf) throws Exception {
|
protected void serviceInit(Configuration conf) throws Exception {
|
||||||
|
UserGroupInformation.setConfiguration(conf);
|
||||||
// Set up the context
|
// Set up the context
|
||||||
this.gpgContext.setStateStoreFacade(FederationStateStoreFacade.getInstance(conf));
|
this.gpgContext.setStateStoreFacade(FederationStateStoreFacade.getInstance(conf));
|
||||||
GPGPolicyFacade gpgPolicyFacade =
|
GPGPolicyFacade gpgPolicyFacade =
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
package org.apache.hadoop.yarn.server.globalpolicygenerator;
|
package org.apache.hadoop.yarn.server.globalpolicygenerator;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||||
import org.apache.hadoop.service.Service;
|
import org.apache.hadoop.service.Service;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
|
import org.apache.hadoop.test.LambdaTestUtils;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -55,4 +57,15 @@ public void testGpgWithFederation() throws InterruptedException, TimeoutExceptio
|
|||||||
return (services.size() == 1 && gpg.getWebApp() != null);
|
return (services.size() == 1 && gpg.getWebApp() != null);
|
||||||
}, 100, 5000);
|
}, 100, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUserProvidedUGIConf() throws Exception {
|
||||||
|
String errMsg = "Invalid attribute value for " +
|
||||||
|
CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION + " of DUMMYAUTH";
|
||||||
|
Configuration dummyConf = new YarnConfiguration();
|
||||||
|
dummyConf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "DUMMYAUTH");
|
||||||
|
GlobalPolicyGenerator gpg = new GlobalPolicyGenerator();
|
||||||
|
LambdaTestUtils.intercept(IllegalArgumentException.class, errMsg, () -> gpg.init(dummyConf));
|
||||||
|
gpg.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
||||||
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
|
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
|
||||||
import org.apache.hadoop.security.SecurityUtil;
|
import org.apache.hadoop.security.SecurityUtil;
|
||||||
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.service.CompositeService;
|
import org.apache.hadoop.service.CompositeService;
|
||||||
import org.apache.hadoop.util.JvmPauseMonitor;
|
import org.apache.hadoop.util.JvmPauseMonitor;
|
||||||
import org.apache.hadoop.util.ShutdownHookManager;
|
import org.apache.hadoop.util.ShutdownHookManager;
|
||||||
@ -120,6 +121,7 @@ protected void doSecureLogin() throws IOException {
|
|||||||
@Override
|
@Override
|
||||||
protected void serviceInit(Configuration config) throws Exception {
|
protected void serviceInit(Configuration config) throws Exception {
|
||||||
this.conf = config;
|
this.conf = config;
|
||||||
|
UserGroupInformation.setConfiguration(this.conf);
|
||||||
// ClientRM Proxy
|
// ClientRM Proxy
|
||||||
clientRMProxyService = createClientRMProxyService();
|
clientRMProxyService = createClientRMProxyService();
|
||||||
addService(clientRMProxyService);
|
addService(clientRMProxyService);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
import org.apache.hadoop.security.authorize.AccessControlList;
|
import org.apache.hadoop.security.authorize.AccessControlList;
|
||||||
import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
|
import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
|
||||||
import org.apache.hadoop.security.http.CrossOriginFilter;
|
import org.apache.hadoop.security.http.CrossOriginFilter;
|
||||||
|
import org.apache.hadoop.test.LambdaTestUtils;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.webapp.WebApp;
|
import org.apache.hadoop.yarn.webapp.WebApp;
|
||||||
import org.eclipse.jetty.servlet.FilterHolder;
|
import org.eclipse.jetty.servlet.FilterHolder;
|
||||||
@ -185,6 +186,18 @@ public void testRouterSupportCrossOrigin() throws ServletException, IOException
|
|||||||
router.stop();
|
router.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUserProvidedUGIConf() throws Exception {
|
||||||
|
String errMsg = "Invalid attribute value for " +
|
||||||
|
CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION + " of DUMMYAUTH";
|
||||||
|
Configuration dummyConf = new YarnConfiguration();
|
||||||
|
dummyConf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "DUMMYAUTH");
|
||||||
|
Router router = new Router();
|
||||||
|
LambdaTestUtils.intercept(IllegalArgumentException.class, errMsg,
|
||||||
|
() -> router.init(dummyConf));
|
||||||
|
router.stop();
|
||||||
|
}
|
||||||
|
|
||||||
private class HttpServletResponseForRouterTest implements HttpServletResponse {
|
private class HttpServletResponseForRouterTest implements HttpServletResponse {
|
||||||
private final Map<String, String> headers = new HashMap<>(1);
|
private final Map<String, String> headers = new HashMap<>(1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user