Examples of MasterKey


Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

    req.setLastKnownContainerTokenMasterKey(this.currentContainerTokenMasterKey);
    req.setLastKnownNMTokenMasterKey(this.currentNMTokenMasterKey);
    NodeHeartbeatResponse heartbeatResponse =
        resourceTracker.nodeHeartbeat(req);
   
    MasterKey masterKeyFromRM = heartbeatResponse.getContainerTokenMasterKey();
    if (masterKeyFromRM != null
        && masterKeyFromRM.getKeyId() != this.currentContainerTokenMasterKey
            .getKeyId()) {
      this.currentContainerTokenMasterKey = masterKeyFromRM;
    }

    masterKeyFromRM = heartbeatResponse.getNMTokenMasterKey();
    if (masterKeyFromRM != null
        && masterKeyFromRM.getKeyId() != this.currentNMTokenMasterKey
            .getKeyId()) {
      this.currentNMTokenMasterKey = masterKeyFromRM;
    }
   
    return heartbeatResponse;
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

      when(context.getContainerTokenSecretManager()).thenReturn(
        new NMContainerTokenSecretManager(conf));
      when(context.getNMTokenSecretManager()).thenReturn(nmTokenSecretMgr);
     
      // Setting master key
      MasterKey masterKey = new MasterKeyPBImpl();
      masterKey.setKeyId(123);
      masterKey.setBytes(ByteBuffer.wrap(new byte[] { (new Integer(123)
        .byteValue()) }));
      context.getContainerTokenSecretManager().setMasterKey(masterKey);
     
      this.user = user;
      this.appId = BuilderUtils.newApplicationId(timestamp, id);

      app = new ApplicationImpl(dispatcher, new ApplicationACLsManager(
          new Configuration()), this.user, appId, null, context);
      containers = new ArrayList<Container>();
      for (int i = 0; i < numContainers; i++) {
        Container container = createMockedContainer(this.appId, i);
        containers.add(container);
        long currentTime = System.currentTimeMillis();
        ContainerTokenIdentifier identifier =
            new ContainerTokenIdentifier(container.getContainerId(), "", "",
              null, currentTime + 2000, masterKey.getKeyId(), currentTime);
        containerTokenIdentifierMap
          .put(identifier.getContainerID(), identifier);
        context.getContainerTokenSecretManager().startContainerSuccessful(
          identifier);
        Assert.assertFalse(context.getContainerTokenSecretManager()
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

      response.setRegistrationResponse(regResponse);
      return response;
    }

    if (isSecurityEnabled()) {
      MasterKey nextMasterKeyForNode =
          this.containerTokenSecretManager.getCurrentKey();
      regResponse.setMasterKey(nextMasterKeyForNode);
    }

    RMNode rmNode = new RMNodeImpl(nodeId, rmContext, host, cmPort, httpPort,
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

    // roller over, send it across
    if (isSecurityEnabled()) {

      boolean shouldSendMasterKey = false;

      MasterKey nextMasterKeyForNode =
          this.containerTokenSecretManager.getNextKey();
      if (nextMasterKeyForNode != null) {
        // nextMasterKeyForNode can be null if there is no outstanding key that
        // is in the activation period.
        MasterKey nodeKnownMasterKey = request.getLastKnownMasterKey();
        if (nodeKnownMasterKey.getKeyId() != nextMasterKeyForNode.getKeyId()) {
          shouldSendMasterKey = true;
        }
      }
      if (shouldSendMasterKey) {
        latestResponse.setMasterKey(nextMasterKeyForNode);
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

      throw new YarnException(
          "Recieved SHUTDOWN signal from Resourcemanager ,Registration of NodeManager failed");
    }

    if (UserGroupInformation.isSecurityEnabled()) {
      MasterKey masterKey = regResponse.getMasterKey();
      // do this now so that its set before we start heartbeating to RM
      LOG.info("Security enabled - updating secret keys now");
      // It is expected that status updater is started by this point and
      // RM gives the shared secret in registration during
      // StatusUpdater#start().
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

            HeartbeatResponse response =
              resourceTracker.nodeHeartbeat(request).getHeartbeatResponse();

            // See if the master-key has rolled over
            if (isSecurityEnabled()) {
              MasterKey updatedMasterKey = response.getMasterKey();
              if (updatedMasterKey != null) {
                // Will be non-null only on roll-over on RM side
                context.getContainerTokenSecretManager().setMasterKey(
                  updatedMasterKey);
              }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

    status.setNodeHealthStatus(healthStatus);
    req.setNodeStatus(status);
    req.setLastKnownMasterKey(this.currentMasterKey);
    HeartbeatResponse heartbeatResponse =
        resourceTracker.nodeHeartbeat(req).getHeartbeatResponse();
    MasterKey masterKeyFromRM = heartbeatResponse.getMasterKey();
    this.currentMasterKey =
        (masterKeyFromRM != null
            && masterKeyFromRM.getKeyId() != this.currentMasterKey.getKeyId()
            ? masterKeyFromRM : this.currentMasterKey);
    return heartbeatResponse;
  }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

    rm.init(conf);
    rm.start();

    MockNM nm = new MockNM("host:1234", 3072, rm.getResourceTrackerService());
    RegistrationResponse registrationResponse = nm.registerNode();
    MasterKey masterKey = registrationResponse.getMasterKey();
    Assert.assertNotNull("Registration should cause a key-update!", masterKey);
    dispatcher.await();

    HeartbeatResponse response = nm.nodeHeartbeat(true);
    Assert.assertNull(
      "First heartbeat after registration shouldn't get any key updates!",
      response.getMasterKey());
    dispatcher.await();

    response = nm.nodeHeartbeat(true);
    Assert
      .assertNull(
        "Even second heartbeat after registration shouldn't get any key updates!",
        response.getMasterKey());
    dispatcher.await();

    // Let's force a roll-over
    RMContainerTokenSecretManager secretManager =
        rm.getRMContainerTokenSecretManager();
    secretManager.rollMasterKey();

    // Heartbeats after roll-over and before activation should be fine.
    response = nm.nodeHeartbeat(true);
    Assert.assertNotNull(
      "Heartbeats after roll-over and before activation should not err out.",
      response.getMasterKey());
    Assert.assertEquals(
      "Roll-over should have incremented the key-id only by one!",
      masterKey.getKeyId() + 1, response.getMasterKey().getKeyId());
    dispatcher.await();

    response = nm.nodeHeartbeat(true);
    Assert.assertNull(
      "Second heartbeat after roll-over shouldn't get any key updates!",
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

      response.setRegistrationResponse(regResponse);
      return response;
    }

    if (isSecurityEnabled()) {
      MasterKey nextMasterKeyForNode =
          this.containerTokenSecretManager.getCurrentKey();
      regResponse.setMasterKey(nextMasterKeyForNode);
    }

    RMNode rmNode = new RMNodeImpl(nodeId, rmContext, host, cmPort, httpPort,
View Full Code Here

Examples of org.apache.hadoop.yarn.server.api.records.MasterKey

    // roller over, send it across
    if (isSecurityEnabled()) {

      boolean shouldSendMasterKey = false;

      MasterKey nextMasterKeyForNode =
          this.containerTokenSecretManager.getNextKey();
      if (nextMasterKeyForNode != null) {
        // nextMasterKeyForNode can be null if there is no outstanding key that
        // is in the activation period.
        MasterKey nodeKnownMasterKey = request.getLastKnownMasterKey();
        if (nodeKnownMasterKey.getKeyId() != nextMasterKeyForNode.getKeyId()) {
          shouldSendMasterKey = true;
        }
      }
      if (shouldSendMasterKey) {
        latestResponse.setMasterKey(nextMasterKeyForNode);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.