YARN-9668. UGI conf doesn't read user overridden configurations on RM and NM startup. (Contributed by Jonathan Hung)
This commit is contained in:
parent
8fb5ca3f40
commit
9b54dd7186
|
@ -381,6 +381,7 @@ public class NodeManager extends CompositeService
|
|||
|
||||
@Override
|
||||
protected void serviceInit(Configuration conf) throws Exception {
|
||||
UserGroupInformation.setConfiguration(conf);
|
||||
rmWorkPreservingRestartEnabled = conf.getBoolean(YarnConfiguration
|
||||
.RM_WORK_PRESERVING_RECOVERY_ENABLED,
|
||||
YarnConfiguration.DEFAULT_RM_WORK_PRESERVING_RECOVERY_ENABLED);
|
||||
|
|
|
@ -23,6 +23,7 @@ import static org.junit.Assert.fail;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerEvent;
|
||||
|
@ -30,7 +31,9 @@ import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Cont
|
|||
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerState;
|
||||
import org.apache.hadoop.yarn.server.nodemanager.nodelabels.NodeLabelsProvider;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
public class TestNodeManager {
|
||||
|
||||
|
@ -42,6 +45,9 @@ public class TestNodeManager {
|
|||
}
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void testContainerExecutorInitCall() {
|
||||
NodeManager nm = new NodeManager();
|
||||
|
@ -170,4 +176,26 @@ public class TestNodeManager {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether NodeManager passes user-provided conf to
|
||||
* UserGroupInformation class. If it reads this (incorrect)
|
||||
* AuthenticationMethod enum an exception is thrown.
|
||||
*/
|
||||
@Test
|
||||
public void testUserProvidedUGIConf() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Invalid attribute value for "
|
||||
+ CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION
|
||||
+ " of DUMMYAUTH");
|
||||
Configuration dummyConf = new YarnConfiguration();
|
||||
dummyConf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
|
||||
"DUMMYAUTH");
|
||||
NodeManager dummyNodeManager = new NodeManager();
|
||||
try {
|
||||
dummyNodeManager.init(dummyConf);
|
||||
} finally {
|
||||
dummyNodeManager.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,6 +263,7 @@ public class ResourceManager extends CompositeService
|
|||
@Override
|
||||
protected void serviceInit(Configuration conf) throws Exception {
|
||||
this.conf = conf;
|
||||
UserGroupInformation.setConfiguration(conf);
|
||||
this.rmContext = new RMContextImpl();
|
||||
rmContext.setResourceManager(this);
|
||||
|
||||
|
|
|
@ -2099,9 +2099,10 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase {
|
|||
conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 2);
|
||||
conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
|
||||
"kerberos");
|
||||
UserGroupInformation.setConfiguration(conf);
|
||||
|
||||
// start RM
|
||||
MockRM rm1 = createMockRM(conf);
|
||||
MockRM rm1 = new TestSecurityMockRM(conf);
|
||||
rm1.start();
|
||||
final MockNM nm1 =
|
||||
new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
|
||||
|
@ -2109,7 +2110,7 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase {
|
|||
RMApp app0 = rm1.submitApp(200);
|
||||
final MockAM am0 = MockRM.launchAndRegisterAM(app0, rm1, nm1);
|
||||
|
||||
MockRM rm2 = new MockRM(conf, rm1.getRMStateStore()) {
|
||||
MockRM rm2 = new TestSecurityMockRM(conf, rm1.getRMStateStore()) {
|
||||
@Override
|
||||
protected ResourceTrackerService createResourceTrackerService() {
|
||||
return new ResourceTrackerService(this.rmContext,
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.IOException;
|
|||
import java.util.Collection;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
|
@ -51,14 +52,19 @@ import org.apache.hadoop.yarn.util.resource.Resources;
|
|||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
public class TestResourceManager {
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(TestResourceManager.class);
|
||||
|
||||
private ResourceManager resourceManager = null;
|
||||
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
Configuration conf = new YarnConfiguration();
|
||||
|
@ -329,4 +335,26 @@ public class TestResourceManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether ResourceManager passes user-provided conf to
|
||||
* UserGroupInformation class. If it reads this (incorrect)
|
||||
* AuthenticationMethod enum an exception is thrown.
|
||||
*/
|
||||
@Test
|
||||
public void testUserProvidedUGIConf() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Invalid attribute value for "
|
||||
+ CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION
|
||||
+ " of DUMMYAUTH");
|
||||
Configuration dummyConf = new YarnConfiguration();
|
||||
dummyConf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
|
||||
"DUMMYAUTH");
|
||||
ResourceManager dummyResourceManager = new ResourceManager();
|
||||
try {
|
||||
dummyResourceManager.init(dummyConf);
|
||||
} finally {
|
||||
dummyResourceManager.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue