Skip to content

Commit

Permalink
Merge pull request #8 from cmacdonald/master
Browse files Browse the repository at this point in the history
Fixes to make security work
  • Loading branch information
jwills committed Sep 1, 2015
2 parents c807733 + d4c6f9c commit 7594844
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Expand Up @@ -30,13 +30,20 @@ public class YarnClientFactory implements MasterConnectionFactory<YarnClient> {
private final Configuration conf;

public YarnClientFactory(Configuration conf) {
this.conf = Preconditions.checkNotNull(conf);
conf = Preconditions.checkNotNull(conf);
this.conf = new YarnConfiguration(conf);
}

@Override
public Configuration getConfig()
{
return this.conf;
}

@Override
public YarnClient connect() {
YarnClient client = YarnClient.createYarnClient();
client.init(new YarnConfiguration(conf));
client.init(conf);
client.start();
return client;
}
Expand Down
Expand Up @@ -87,10 +87,10 @@ public YarnClientServiceImpl(YarnClientParameters parameters,
protected void startUp() throws IOException {
ByteBuffer serializedTokens = null;
if (UserGroupInformation.isSecurityEnabled()) {
Configuration conf = yarnClient.getConfig();
Configuration conf = this.yarnClientFactory.getConfig();
FileSystem fs = FileSystem.get(conf);
Credentials credentials = new Credentials();
String tokenRenewer = yarnClient.getConfig().get(YarnConfiguration.RM_PRINCIPAL);
String tokenRenewer = this.yarnClientFactory.getConfig().get(YarnConfiguration.RM_PRINCIPAL);
if (tokenRenewer == null || tokenRenewer.length() == 0) {
throw new IOException("Can't get Master Kerberos principal for the RM to use as renewer");
}
Expand Down Expand Up @@ -120,6 +120,7 @@ protected void startUp() throws IOException {
// Setup the container for the application master.
ContainerLaunchParameters appMasterParams = parameters.getApplicationMasterParameters(applicationId);
ContainerLaunchContext clc = clcFactory.create(appMasterParams);
LOG.debug("Master context: " + clc);
appContext.setResource(clcFactory.createResource(appMasterParams));
appContext.setQueue(parameters.getQueue());
appContext.setPriority(clcFactory.createPriority(appMasterParams.getPriority()));
Expand Down
Expand Up @@ -13,11 +13,12 @@
* License.
*/
package com.cloudera.kitten;

import org.apache.hadoop.conf.Configuration;
/**
* An interface for handling the connection to one of the master YARN services, like the
* ResourceManager.
*/
public interface MasterConnectionFactory<T> {
public Configuration getConfig();
T connect();
}

0 comments on commit 7594844

Please sign in to comment.