use of io.quarkiverse.operatorsdk.runtime.ResourceInfo in project quarkus-operator-sdk by quarkiverse.
the class BundleProcessor method gatherCSVMetadata.
@SuppressWarnings("unchecked")
@BuildStep
CSVMetadataBuildItem gatherCSVMetadata(ApplicationInfoBuildItem configuration, BundleGenerationConfiguration bundleConfiguration, CombinedIndexBuildItem combinedIndexBuildItem, ConfigurationServiceBuildItem configurations) {
final var controllerConfigs = configurations.getControllerConfigs();
final var index = combinedIndexBuildItem.getIndex();
final var operatorCsvMetadata = getCSVMetadataForOperator(bundleConfiguration.packageName.orElse(configuration.getName()), index);
final var csvGroups = new HashMap<CSVMetadataHolder, List<AugmentedResourceInfo>>();
ClassUtils.getKnownReconcilers(index, log).forEach(reconcilerInfo -> {
// figure out which group should be used to generate CSV
final var name = reconcilerInfo.name();
log.debugv("Processing reconciler: {0}", name);
final var config = controllerConfigs.get(name);
if (config == null) {
throw new IllegalStateException("Missing configuration for reconciler " + name);
}
// Check whether the reconciler must be shipped using a custom bundle
CSVMetadataHolder csvMetadata = getCsvMetadataFromAnnotation(operatorCsvMetadata, reconcilerInfo.classInfo()).orElse(operatorCsvMetadata);
final var resourceFullName = config.getResourceTypeName();
final var resourceInfo = ResourceInfo.createFrom(config.getResourceClass(), resourceFullName, name, config.getSpecClassName(), config.getStatusClassName());
csvGroups.computeIfAbsent(csvMetadata, m -> new ArrayList<>()).add(new AugmentedResourceInfo(resourceInfo, csvMetadata.name));
});
return new CSVMetadataBuildItem(csvGroups);
}
Aggregations