use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ClouderaManagerClusterCreationSetupService method filterParcelsIfNecessary.
private Set<ClouderaManagerProduct> filterParcelsIfNecessary(Cluster cluster, Set<ClouderaManagerProduct> products) {
Stack stack = cluster.getStack();
if (stack.isDatalake()) {
return Set.of(clouderaManagerProductsProvider.getCdhProducts(products));
} else {
LOGGER.info("Product list before filter out products by blueprint: {}", products);
Set<ClouderaManagerProduct> filteredProducts = parcelFilterService.filterParcelsByBlueprint(stack.getId(), products, cluster.getBlueprint());
LOGGER.info("Product list after filter out products by blueprint: {}", filteredProducts);
return filteredProducts;
}
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ClouderaManagerClusterCreationSetupService method determineCdhRepoConfig.
private Set<ClouderaManagerProduct> determineCdhRepoConfig(Cluster cluster, List<Component> stackCdhRepoConfig, String osType, String blueprintCdhVersion, String imageCatalogName) throws CloudbreakImageCatalogException {
if (Objects.isNull(stackCdhRepoConfig) || stackCdhRepoConfig.isEmpty()) {
DefaultCDHInfo defaultCDHInfo = getDefaultCDHInfo(cluster, blueprintCdhVersion, osType, imageCatalogName);
Map<String, String> stack = defaultCDHInfo.getRepo().getStack();
Set<ClouderaManagerProduct> cdhProduct = Set.of(new ClouderaManagerProduct().withVersion(defaultCDHInfo.getVersion()).withName(stack.get("repoid").split("-")[0]).withParcel(stack.get(osType)));
LOGGER.debug("Determined CDH product: {}", cdhProduct);
return cdhProduct;
} else {
Set<ClouderaManagerProduct> products = stackCdhRepoConfig.stream().map(Component::getAttributes).map(json -> json.getSilent(ClouderaManagerProduct.class)).collect(Collectors.toSet());
return filterParcelsIfNecessary(cluster, products);
}
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class StackMatrixService method getImageBasedCMStackDescriptor.
private ClouderaManagerStackDescriptorV4Response getImageBasedCMStackDescriptor(DefaultCDHInfo stackInfo, Image image) {
ClouderaManagerStackDescriptorV4Response stackDescriptorV4 = stackInfoToClouderaManagerStackDescriptorV4ResponseConverter.convert(stackInfo);
RepositoryInfo cmInfo = new RepositoryInfo();
cmInfo.setVersion(image.getPackageVersion(ImagePackageVersion.CM));
cmInfo.setRepo(image.getRepo().entrySet().stream().collect(Collectors.toMap(Entry::getKey, e -> {
RepositoryDetails repo = new RepositoryDetails();
repo.setBaseurl(e.getValue());
return repo;
})));
ClouderaManagerInfoV4Response cmInfoJson = repositoryInfoToClouderaManagerInfoV4ResponseConverter.convert(cmInfo);
stackDescriptorV4.setClouderaManager(cmInfoJson);
for (ClouderaManagerProduct parcel : stackInfo.getParcels()) {
stackDescriptorV4.getProducts().add(ClouderaManagerProductToClouderaManagerProductV4Response.convert(parcel));
}
stackDescriptorV4.setProductDefinitions(stackInfo.getCsd());
return stackDescriptorV4;
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ParcelFilterService method filterParcels.
private Set<ClouderaManagerProduct> filterParcels(Long stackId, Set<ClouderaManagerProduct> parcels, Set<String> requiredServicesInBlueprint) {
Set<ClouderaManagerProduct> requiredParcels = new HashSet<>();
Set<ClouderaManagerProduct> notAccessibleParcels = new HashSet<>();
Iterator<ClouderaManagerProduct> parcelIterator = parcels.iterator();
while (!requiredServicesInBlueprint.isEmpty() && parcelIterator.hasNext()) {
ClouderaManagerProduct parcel = parcelIterator.next();
ImmutablePair<ManifestStatus, Manifest> manifest = manifestRetrieverService.readRepoManifest(parcel.getParcel());
if (manifestAvailable(manifest)) {
Set<String> servicesInParcel = getAllServiceNameInParcel(manifest.right);
LOGGER.debug("The {} parcel contains the following services: {}", parcel.getName(), servicesInParcel);
if (servicesArePresentInTheBlueprint(requiredServicesInBlueprint, servicesInParcel, parcel) || isCustomParcel(stackId, parcel)) {
requiredParcels.add(parcel);
LOGGER.debug("Removing {} from the remaining required services because these services are found in {} parcel.", servicesInParcel, parcel);
requiredServicesInBlueprint.removeAll(servicesInParcel);
} else {
LOGGER.info("Skip parcel '{}' as there isn't any service both in the manifest and in the blueprint.", parcel);
}
} else {
LOGGER.info("Add parcel '{}' as we were unable to check parcel's manifest.", parcel);
notAccessibleParcels.add(parcel);
}
}
if (!requiredServicesInBlueprint.isEmpty()) {
LOGGER.debug("Add {} not accessible parcels to the required parcel list because the {} required services are not found in the accessible parcels.", notAccessibleParcels, requiredServicesInBlueprint);
requiredParcels.addAll(notAccessibleParcels);
}
return requiredParcels;
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ParcelService method getParcelComponentsByBlueprint.
public Set<ClusterComponent> getParcelComponentsByBlueprint(Stack stack) {
Set<ClusterComponent> components = getComponents(stack);
LOGGER.debug("The following components are available in the cluster {}", components);
if (stack.isDatalake()) {
return getDataLakeClusterComponents(components);
} else {
Map<String, ClusterComponent> cmProductMap = new HashMap<>();
Set<ClouderaManagerProduct> cmProducts = new HashSet<>();
for (ClusterComponent clusterComponent : components) {
ClouderaManagerProduct product = clusterComponent.getAttributes().getSilent(ClouderaManagerProduct.class);
cmProductMap.put(product.getName(), clusterComponent);
cmProducts.add(product);
}
cmProducts = filterParcelsByBlueprint(stack.getId(), cmProducts, stack.getCluster().getBlueprint());
Set<ClusterComponent> componentsByRequiredProducts = getComponentsByRequiredProducts(cmProductMap, cmProducts);
LOGGER.debug("The following components are required for cluster {}", componentsByRequiredProducts);
return componentsByRequiredProducts;
}
}
Aggregations