YARN-1598. HA-related rmadmin commands don't work on a secure cluster (kasha)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1558253 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
04c7b8afb5
commit
1561f56b30
|
@ -315,6 +315,8 @@ Release 2.4.0 - UNRELEASED
|
||||||
YARN-1166. Fixed app-specific and attempt-specific QueueMetrics to be
|
YARN-1166. Fixed app-specific and attempt-specific QueueMetrics to be
|
||||||
triggered by accordingly app event and attempt event.
|
triggered by accordingly app event and attempt event.
|
||||||
|
|
||||||
|
YARN-1598. HA-related rmadmin commands don't work on a secure cluster (kasha)
|
||||||
|
|
||||||
Release 2.3.0 - UNRELEASED
|
Release 2.3.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.conf.Configured;
|
import org.apache.hadoop.conf.Configured;
|
||||||
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||||
import org.apache.hadoop.ha.HAAdmin;
|
import org.apache.hadoop.ha.HAAdmin;
|
||||||
import org.apache.hadoop.ha.HAServiceTarget;
|
import org.apache.hadoop.ha.HAServiceTarget;
|
||||||
import org.apache.hadoop.ipc.RemoteException;
|
import org.apache.hadoop.ipc.RemoteException;
|
||||||
|
@ -364,13 +365,26 @@ public class RMAdminCLI extends HAAdmin {
|
||||||
@Override
|
@Override
|
||||||
public void setConf(Configuration conf) {
|
public void setConf(Configuration conf) {
|
||||||
if (conf != null) {
|
if (conf != null) {
|
||||||
if (!(conf instanceof YarnConfiguration)) {
|
conf = addSecurityConfiguration(conf);
|
||||||
conf = new YarnConfiguration(conf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
super.setConf(conf);
|
super.setConf(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the requisite security principal settings to the given Configuration,
|
||||||
|
* returning a copy.
|
||||||
|
* @param conf the original config
|
||||||
|
* @return a copy with the security settings added
|
||||||
|
*/
|
||||||
|
private static Configuration addSecurityConfiguration(Configuration conf) {
|
||||||
|
// Make a copy so we don't mutate it. Also use an YarnConfiguration to
|
||||||
|
// force loading of yarn-site.xml.
|
||||||
|
conf = new YarnConfiguration(conf);
|
||||||
|
conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
|
||||||
|
conf.get(YarnConfiguration.RM_PRINCIPAL, ""));
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HAServiceTarget resolveTarget(String rmId) {
|
protected HAServiceTarget resolveTarget(String rmId) {
|
||||||
Collection<String> rmIds = HAUtil.getRMHAIds(getConf());
|
Collection<String> rmIds = HAUtil.getRMHAIds(getConf());
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.security.authorize;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||||
import org.apache.hadoop.ha.HAServiceProtocol;
|
import org.apache.hadoop.ha.HAServiceProtocol;
|
||||||
import org.apache.hadoop.security.authorize.PolicyProvider;
|
import org.apache.hadoop.security.authorize.PolicyProvider;
|
||||||
import org.apache.hadoop.security.authorize.Service;
|
import org.apache.hadoop.security.authorize.Service;
|
||||||
|
@ -53,6 +54,9 @@ public class RMPolicyProvider extends PolicyProvider {
|
||||||
new Service(
|
new Service(
|
||||||
YarnConfiguration.YARN_SECURITY_SERVICE_AUTHORIZATION_CONTAINER_MANAGEMENT_PROTOCOL,
|
YarnConfiguration.YARN_SECURITY_SERVICE_AUTHORIZATION_CONTAINER_MANAGEMENT_PROTOCOL,
|
||||||
ContainerManagementProtocolPB.class),
|
ContainerManagementProtocolPB.class),
|
||||||
|
new Service(
|
||||||
|
CommonConfigurationKeys.SECURITY_HA_SERVICE_PROTOCOL_ACL,
|
||||||
|
HAServiceProtocol.class),
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue