merge YARN-615 from trunk. Rename ContainerLaunchContext.containerTokens to tokens. Contributed by Vinod Kumar Vavilapalli.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1482200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6706e58f61
commit
1f922d3c51
|
@ -810,7 +810,7 @@ public abstract class TaskAttemptImpl implements
|
||||||
ContainerLaunchContext container = BuilderUtils.newContainerLaunchContext(
|
ContainerLaunchContext container = BuilderUtils.newContainerLaunchContext(
|
||||||
commonContainerSpec.getUser(),
|
commonContainerSpec.getUser(),
|
||||||
commonContainerSpec.getLocalResources(), myEnv, commands,
|
commonContainerSpec.getLocalResources(), myEnv, commands,
|
||||||
myServiceData, commonContainerSpec.getContainerTokens().duplicate(),
|
myServiceData, commonContainerSpec.getTokens().duplicate(),
|
||||||
applicationACLs);
|
applicationACLs);
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class TestTaskAttemptContainerRequest {
|
||||||
Credentials launchCredentials = new Credentials();
|
Credentials launchCredentials = new Credentials();
|
||||||
|
|
||||||
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
||||||
dibb.reset(launchCtx.getContainerTokens());
|
dibb.reset(launchCtx.getTokens());
|
||||||
launchCredentials.readTokenStorageStream(dibb);
|
launchCredentials.readTokenStorageStream(dibb);
|
||||||
|
|
||||||
// verify all tokens specified for the task attempt are in the launch context
|
// verify all tokens specified for the task attempt are in the launch context
|
||||||
|
|
|
@ -46,6 +46,9 @@ Release 2.0.5-beta - UNRELEASED
|
||||||
YARN-630. Changed AMRMProtocol api to throw IOException and
|
YARN-630. Changed AMRMProtocol api to throw IOException and
|
||||||
YarnRemoteException. (Xuan Gong via vinodkv)
|
YarnRemoteException. (Xuan Gong via vinodkv)
|
||||||
|
|
||||||
|
YARN-615. Rename ContainerLaunchContext.containerTokens to tokens.
|
||||||
|
(Vinod Kumar Vavilapalli via sseth)
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
|
|
||||||
YARN-482. FS: Extend SchedulingMode to intermediate queues.
|
YARN-482. FS: Extend SchedulingMode to intermediate queues.
|
||||||
|
|
|
@ -68,20 +68,24 @@ public interface ContainerLaunchContext {
|
||||||
void setUser(String user);
|
void setUser(String user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get security tokens (if security is enabled).
|
* Get all the tokens needed by this container. It may include file-system
|
||||||
* @return security tokens (if security is enabled)
|
* tokens, ApplicationMaster related tokens if this container is an
|
||||||
|
* ApplicationMaster or framework level tokens needed by this container to
|
||||||
|
* communicate to various services in a secure manner.
|
||||||
|
*
|
||||||
|
* @return tokens needed by this container.
|
||||||
*/
|
*/
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
ByteBuffer getContainerTokens();
|
ByteBuffer getTokens();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set security tokens (if security is enabled).
|
* Set security tokens needed by this container.
|
||||||
* @param containerToken security tokens
|
* @param tokens security tokens
|
||||||
*/
|
*/
|
||||||
@Public
|
@Public
|
||||||
@Stable
|
@Stable
|
||||||
void setContainerTokens(ByteBuffer containerToken);
|
void setTokens(ByteBuffer tokens);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get <code>LocalResource</code> required by the container.
|
* Get <code>LocalResource</code> required by the container.
|
||||||
|
|
|
@ -47,7 +47,7 @@ implements ContainerLaunchContext {
|
||||||
boolean viaProto = false;
|
boolean viaProto = false;
|
||||||
|
|
||||||
private Map<String, LocalResource> localResources = null;
|
private Map<String, LocalResource> localResources = null;
|
||||||
private ByteBuffer containerTokens = null;
|
private ByteBuffer tokens = null;
|
||||||
private Map<String, ByteBuffer> serviceData = null;
|
private Map<String, ByteBuffer> serviceData = null;
|
||||||
private Map<String, String> environment = null;
|
private Map<String, String> environment = null;
|
||||||
private List<String> commands = null;
|
private List<String> commands = null;
|
||||||
|
@ -73,8 +73,8 @@ implements ContainerLaunchContext {
|
||||||
if (this.localResources != null) {
|
if (this.localResources != null) {
|
||||||
addLocalResourcesToProto();
|
addLocalResourcesToProto();
|
||||||
}
|
}
|
||||||
if (this.containerTokens != null) {
|
if (this.tokens != null) {
|
||||||
builder.setContainerTokens(convertToProtoFormat(this.containerTokens));
|
builder.setTokens(convertToProtoFormat(this.tokens));
|
||||||
}
|
}
|
||||||
if (this.serviceData != null) {
|
if (this.serviceData != null) {
|
||||||
addServiceDataToProto();
|
addServiceDataToProto();
|
||||||
|
@ -226,25 +226,25 @@ implements ContainerLaunchContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBuffer getContainerTokens() {
|
public ByteBuffer getTokens() {
|
||||||
ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder;
|
ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder;
|
||||||
if (this.containerTokens != null) {
|
if (this.tokens != null) {
|
||||||
return this.containerTokens;
|
return this.tokens;
|
||||||
}
|
}
|
||||||
if (!p.hasContainerTokens()) {
|
if (!p.hasTokens()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
this.containerTokens = convertFromProtoFormat(p.getContainerTokens());
|
this.tokens = convertFromProtoFormat(p.getTokens());
|
||||||
return this.containerTokens;
|
return this.tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContainerTokens(ByteBuffer containerTokens) {
|
public void setTokens(ByteBuffer tokens) {
|
||||||
maybeInitBuilder();
|
maybeInitBuilder();
|
||||||
if (containerTokens == null) {
|
if (tokens == null) {
|
||||||
builder.clearContainerTokens();
|
builder.clearTokens();
|
||||||
}
|
}
|
||||||
this.containerTokens = containerTokens;
|
this.tokens = tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -269,7 +269,7 @@ message QueueUserACLInfoProto {
|
||||||
message ContainerLaunchContextProto {
|
message ContainerLaunchContextProto {
|
||||||
optional string user = 1;
|
optional string user = 1;
|
||||||
repeated StringLocalResourceMapProto localResources = 2;
|
repeated StringLocalResourceMapProto localResources = 2;
|
||||||
optional bytes container_tokens = 3;
|
optional bytes tokens = 3;
|
||||||
repeated StringBytesMapProto service_data = 4;
|
repeated StringBytesMapProto service_data = 4;
|
||||||
repeated StringStringMapProto environment = 5;
|
repeated StringStringMapProto environment = 5;
|
||||||
repeated string command = 6;
|
repeated string command = 6;
|
||||||
|
|
|
@ -288,7 +288,7 @@ public class BuilderUtils {
|
||||||
public static ContainerLaunchContext newContainerLaunchContext(
|
public static ContainerLaunchContext newContainerLaunchContext(
|
||||||
String user, Map<String, LocalResource> localResources,
|
String user, Map<String, LocalResource> localResources,
|
||||||
Map<String, String> environment, List<String> commands,
|
Map<String, String> environment, List<String> commands,
|
||||||
Map<String, ByteBuffer> serviceData, ByteBuffer containerTokens,
|
Map<String, ByteBuffer> serviceData, ByteBuffer tokens,
|
||||||
Map<ApplicationAccessType, String> acls) {
|
Map<ApplicationAccessType, String> acls) {
|
||||||
ContainerLaunchContext container = recordFactory
|
ContainerLaunchContext container = recordFactory
|
||||||
.newRecordInstance(ContainerLaunchContext.class);
|
.newRecordInstance(ContainerLaunchContext.class);
|
||||||
|
@ -297,7 +297,7 @@ public class BuilderUtils {
|
||||||
container.setEnvironment(environment);
|
container.setEnvironment(environment);
|
||||||
container.setCommands(commands);
|
container.setCommands(commands);
|
||||||
container.setServiceData(serviceData);
|
container.setServiceData(serviceData);
|
||||||
container.setContainerTokens(containerTokens);
|
container.setTokens(tokens);
|
||||||
container.setApplicationACLs(acls);
|
container.setApplicationACLs(acls);
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ public class ContainerManagerImpl extends CompositeService implements
|
||||||
+ launchContext.getUser());
|
+ launchContext.getUser());
|
||||||
|
|
||||||
// //////////// Parse credentials
|
// //////////// Parse credentials
|
||||||
ByteBuffer tokens = launchContext.getContainerTokens();
|
ByteBuffer tokens = launchContext.getTokens();
|
||||||
Credentials credentials = new Credentials();
|
Credentials credentials = new Credentials();
|
||||||
if (tokens != null) {
|
if (tokens != null) {
|
||||||
DataInputByteBuffer buf = new DataInputByteBuffer();
|
DataInputByteBuffer buf = new DataInputByteBuffer();
|
||||||
|
|
|
@ -316,7 +316,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Credentials credentials = new Credentials();
|
Credentials credentials = new Credentials();
|
||||||
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
||||||
ByteBuffer tokens = application.getAMContainerSpec().getContainerTokens();
|
ByteBuffer tokens = application.getAMContainerSpec().getTokens();
|
||||||
if (tokens != null) {
|
if (tokens != null) {
|
||||||
dibb.reset(tokens);
|
dibb.reset(tokens);
|
||||||
credentials.readTokenStorageStream(dibb);
|
credentials.readTokenStorageStream(dibb);
|
||||||
|
|
|
@ -195,9 +195,9 @@ public class AMLauncher implements Runnable {
|
||||||
Credentials credentials = new Credentials();
|
Credentials credentials = new Credentials();
|
||||||
|
|
||||||
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
DataInputByteBuffer dibb = new DataInputByteBuffer();
|
||||||
if (container.getContainerTokens() != null) {
|
if (container.getTokens() != null) {
|
||||||
// TODO: Don't do this kind of checks everywhere.
|
// TODO: Don't do this kind of checks everywhere.
|
||||||
dibb.reset(container.getContainerTokens());
|
dibb.reset(container.getTokens());
|
||||||
credentials.readTokenStorageStream(dibb);
|
credentials.readTokenStorageStream(dibb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ public class AMLauncher implements Runnable {
|
||||||
}
|
}
|
||||||
DataOutputBuffer dob = new DataOutputBuffer();
|
DataOutputBuffer dob = new DataOutputBuffer();
|
||||||
credentials.writeTokenStorageToStream(dob);
|
credentials.writeTokenStorageToStream(dob);
|
||||||
container.setContainerTokens(ByteBuffer.wrap(dob.getData(), 0,
|
container.setTokens(ByteBuffer.wrap(dob.getData(), 0,
|
||||||
dob.getLength()));
|
dob.getLength()));
|
||||||
|
|
||||||
SecretKey clientSecretKey =
|
SecretKey clientSecretKey =
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class MockRM extends ResourceManager {
|
||||||
DataOutputBuffer dob = new DataOutputBuffer();
|
DataOutputBuffer dob = new DataOutputBuffer();
|
||||||
ts.writeTokenStorageToStream(dob);
|
ts.writeTokenStorageToStream(dob);
|
||||||
ByteBuffer securityTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
|
ByteBuffer securityTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
|
||||||
clc.setContainerTokens(securityTokens);
|
clc.setTokens(securityTokens);
|
||||||
}
|
}
|
||||||
sub.setAMContainerSpec(clc);
|
sub.setAMContainerSpec(clc);
|
||||||
req.setApplicationSubmissionContext(sub);
|
req.setApplicationSubmissionContext(sub);
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class TestAMAuthorization {
|
||||||
public StartContainerResponse
|
public StartContainerResponse
|
||||||
startContainer(StartContainerRequest request)
|
startContainer(StartContainerRequest request)
|
||||||
throws YarnRemoteException {
|
throws YarnRemoteException {
|
||||||
amTokens = request.getContainerLaunchContext().getContainerTokens();
|
amTokens = request.getContainerLaunchContext().getTokens();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ public class TestRMRestart {
|
||||||
securityTokens.rewind();
|
securityTokens.rewind();
|
||||||
Assert.assertEquals(securityTokens, appState
|
Assert.assertEquals(securityTokens, appState
|
||||||
.getApplicationSubmissionContext().getAMContainerSpec()
|
.getApplicationSubmissionContext().getAMContainerSpec()
|
||||||
.getContainerTokens());
|
.getTokens());
|
||||||
|
|
||||||
// start new RM
|
// start new RM
|
||||||
MockRM rm2 = new TestSecurityMockRM(conf, memStore);
|
MockRM rm2 = new TestSecurityMockRM(conf, memStore);
|
||||||
|
|
Loading…
Reference in New Issue