|
@@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt;
|
|
|
|
|
|
import static org.apache.hadoop.yarn.util.StringHelper.pjoin;
|
|
import static org.apache.hadoop.yarn.util.StringHelper.pjoin;
|
|
|
|
|
|
-import java.net.InetSocketAddress;
|
|
|
|
import java.net.URI;
|
|
import java.net.URI;
|
|
import java.net.URISyntaxException;
|
|
import java.net.URISyntaxException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -41,7 +40,6 @@ import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.http.HttpConfig;
|
|
import org.apache.hadoop.http.HttpConfig;
|
|
import org.apache.hadoop.io.Text;
|
|
import org.apache.hadoop.io.Text;
|
|
import org.apache.hadoop.security.Credentials;
|
|
import org.apache.hadoop.security.Credentials;
|
|
-import org.apache.hadoop.security.SecurityUtil;
|
|
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
import org.apache.hadoop.security.token.Token;
|
|
import org.apache.hadoop.security.token.Token;
|
|
import org.apache.hadoop.util.ExitUtil;
|
|
import org.apache.hadoop.util.ExitUtil;
|
|
@@ -62,7 +60,6 @@ import org.apache.hadoop.yarn.event.EventHandler;
|
|
import org.apache.hadoop.yarn.factories.RecordFactory;
|
|
import org.apache.hadoop.yarn.factories.RecordFactory;
|
|
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
|
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
|
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
|
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
|
-import org.apache.hadoop.yarn.security.AMRMTokenSelector;
|
|
|
|
import org.apache.hadoop.yarn.security.client.ClientToAMTokenIdentifier;
|
|
import org.apache.hadoop.yarn.security.client.ClientToAMTokenIdentifier;
|
|
import org.apache.hadoop.yarn.security.client.ClientToAMTokenSelector;
|
|
import org.apache.hadoop.yarn.security.client.ClientToAMTokenSelector;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService;
|
|
@@ -684,15 +681,11 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
|
appAttemptTokens.getAllTokens());
|
|
appAttemptTokens.getAllTokens());
|
|
}
|
|
}
|
|
|
|
|
|
- InetSocketAddress serviceAddr =
|
|
|
|
- conf.getSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS,
|
|
|
|
- YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
|
|
|
|
- YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);
|
|
|
|
- AMRMTokenSelector appTokenSelector = new AMRMTokenSelector();
|
|
|
|
|
|
+ // Only one AMRMToken is stored per-attempt, so this should be fine. Can't
|
|
|
|
+ // use TokenSelector as service may change - think fail-over.
|
|
this.amrmToken =
|
|
this.amrmToken =
|
|
- appTokenSelector.selectToken(
|
|
|
|
- SecurityUtil.buildTokenService(serviceAddr),
|
|
|
|
- appAttemptTokens.getAllTokens());
|
|
|
|
|
|
+ (Token<AMRMTokenIdentifier>) appAttemptTokens
|
|
|
|
+ .getToken(RMStateStore.AM_RM_TOKEN_SERVICE);
|
|
|
|
|
|
// For now, no need to populate tokens back to AMRMTokenSecretManager,
|
|
// For now, no need to populate tokens back to AMRMTokenSecretManager,
|
|
// because running attempts are rebooted. Later in work-preserve restart,
|
|
// because running attempts are rebooted. Later in work-preserve restart,
|
|
@@ -736,18 +729,9 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
|
// create AMRMToken
|
|
// create AMRMToken
|
|
AMRMTokenIdentifier id =
|
|
AMRMTokenIdentifier id =
|
|
new AMRMTokenIdentifier(appAttempt.applicationAttemptId);
|
|
new AMRMTokenIdentifier(appAttempt.applicationAttemptId);
|
|
- Token<AMRMTokenIdentifier> amRmToken =
|
|
|
|
|
|
+ appAttempt.amrmToken =
|
|
new Token<AMRMTokenIdentifier>(id,
|
|
new Token<AMRMTokenIdentifier>(id,
|
|
appAttempt.rmContext.getAMRMTokenSecretManager());
|
|
appAttempt.rmContext.getAMRMTokenSecretManager());
|
|
- InetSocketAddress serviceAddr =
|
|
|
|
- appAttempt.conf.getSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS,
|
|
|
|
- YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS,
|
|
|
|
- YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT);
|
|
|
|
- // normally the client should set the service after acquiring the
|
|
|
|
- // token, but this token is directly provided to the AMs
|
|
|
|
- SecurityUtil.setTokenService(amRmToken, serviceAddr);
|
|
|
|
-
|
|
|
|
- appAttempt.amrmToken = amRmToken;
|
|
|
|
|
|
|
|
// Add the application to the scheduler
|
|
// Add the application to the scheduler
|
|
appAttempt.eventHandler.handle(
|
|
appAttempt.eventHandler.handle(
|