use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class HostMetadataSetup method setupHostMetadata.
public void setupHostMetadata(Long stackId) throws CloudbreakException {
LOGGER.info("Setting up host metadata for the cluster.");
Stack stack = stackService.getByIdWithLists(stackId);
if (!orchestratorTypeResolver.resolveType(stack.getOrchestrator()).containerOrchestrator()) {
Set<InstanceMetaData> allInstanceMetaData = stack.getRunningInstanceMetaData();
updateWithHostData(stack, stack.getRunningInstanceMetaData());
instanceMetaDataRepository.save(allInstanceMetaData);
}
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class GeneralClusterConfigsProvider method generalClusterConfigs.
public GeneralClusterConfigs generalClusterConfigs(Stack stack, Cluster cluster, IdentityUser identityUser) {
boolean gatewayInstanceMetadataPresented = false;
boolean instanceMetadataPresented = false;
if (stack.getInstanceGroups() != null && !stack.getInstanceGroups().isEmpty()) {
List<InstanceMetaData> gatewayInstanceMetadata = stack.getGatewayInstanceMetadata();
gatewayInstanceMetadataPresented = gatewayInstanceMetadata.size() > 1;
instanceMetadataPresented = true;
}
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setIdentityUserEmail(identityUser.getUsername());
generalClusterConfigs.setAmbariIp(cluster.getAmbariIp());
generalClusterConfigs.setInstanceGroupsPresented(instanceMetadataPresented);
generalClusterConfigs.setGatewayInstanceMetadataPresented(gatewayInstanceMetadataPresented);
generalClusterConfigs.setClusterName(cluster.getName());
generalClusterConfigs.setPassword(cluster.getPassword());
generalClusterConfigs.setExecutorType(cluster.getExecutorType());
generalClusterConfigs.setStackName(stack.getName());
generalClusterConfigs.setUuid(stack.getUuid());
generalClusterConfigs.setUserName(cluster.getUserName());
generalClusterConfigs.setNodeCount(stack.getFullNodeCount());
generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.ofNullable(stack.getPrimaryGatewayInstance().getDiscoveryFQDN()));
return generalClusterConfigs;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class HdfConfigProvider method createHdfConfig.
public HdfConfigs createHdfConfig(Set<HostGroup> hostgroups, Map<String, List<InstanceMetaData>> groupInstances, String blueprintText) {
BlueprintTextProcessor blueprintTextProcessor = createTextProcessor(blueprintText);
Set<String> nifiMasters = collectNifiMasters(blueprintText);
Set<InstanceGroup> nifiIgs = collectInstanceGroupsWhichContainsNifiMasters(hostgroups, nifiMasters);
List<String> nifiFqdns = collectFqdnsByInstanceGroupName(groupInstances, nifiIgs);
AtomicInteger index = new AtomicInteger(0);
String nodeIdentities = nifiFqdns.stream().map(fqdn -> String.format("<property name=\"Node Identity %s\">CN=%s, OU=NIFI</property>", index.addAndGet(1), fqdn)).collect(Collectors.joining());
return new HdfConfigs(nodeIdentities, getProxyHostsParameter(nifiIgs, blueprintTextProcessor, groupInstances));
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class ClusterToClusterResponseConverter method prepareServiceEndpointsMap.
private Map<String, String> prepareServiceEndpointsMap(Cluster cluster, String ambariIp) {
Set<HostGroup> hostGroups = cluster.getHostGroups();
Blueprint blueprint = cluster.getBlueprint();
Map<String, String> result = new HashMap<>();
List<Port> ports = NetworkUtils.getPorts(Optional.empty());
try {
JsonNode hostGroupsNode = blueprintValidator.getHostGroupNode(blueprint);
Map<String, HostGroup> hostGroupMap = blueprintValidator.createHostGroupMap(hostGroups);
for (JsonNode hostGroupNode : hostGroupsNode) {
String hostGroupName = blueprintValidator.getHostGroupName(hostGroupNode);
JsonNode componentsNode = blueprintValidator.getComponentsNode(hostGroupNode);
HostGroup actualHostgroup = hostGroupMap.get(hostGroupName);
String serviceAddress;
if (actualHostgroup.getConstraint().getInstanceGroup() != null) {
InstanceMetaData next = actualHostgroup.getConstraint().getInstanceGroup().getInstanceMetaData().iterator().next();
serviceAddress = next.getPublicIpWrapper();
} else {
serviceAddress = actualHostgroup.getHostMetadata().iterator().next().getHostName();
}
for (JsonNode componentNode : componentsNode) {
String componentName = componentNode.get("name").asText();
StackServiceComponentDescriptor componentDescriptor = stackServiceComponentDescs.get(componentName);
collectServicePorts(result, ports, ambariIp, serviceAddress, componentDescriptor, cluster);
}
}
} catch (Exception ignored) {
return result;
}
return result;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class AmbariClusterService method updateInstanceMetadataStateToRegistered.
private void updateInstanceMetadataStateToRegistered(Long stackId, HostMetadata host) {
InstanceMetaData instanceMetaData = instanceMetaDataRepository.findHostInStack(stackId, host.getHostName());
if (instanceMetaData != null) {
instanceMetaData.setInstanceStatus(InstanceStatus.REGISTERED);
instanceMetadataRepository.save(instanceMetaData);
}
}
Aggregations