use of io.quarkus.kubernetes.spi.DecoratorBuildItem in project quarkus-operator-sdk by quarkiverse.
the class OperatorSDKProcessor method addRBACForResources.
@BuildStep(onlyIf = IsRBACEnabled.class)
@SuppressWarnings("unchecked")
public void addRBACForResources(BuildProducer<DecoratorBuildItem> decorators, ConfigurationServiceBuildItem configurations) {
final var configs = configurations.getControllerConfigs();
final var mappings = new HashMap<String, ResourceInfo>(configs.size());
configs.forEach((controllerName, config) -> {
final var augmented = ResourceInfo.createFrom(config.getResourceClass(), config.getResourceTypeName(), controllerName, config.getSpecClassName(), config.getStatusClassName());
mappings.put(controllerName, augmented);
});
decorators.produce(new DecoratorBuildItem(new AddClusterRolesDecorator(mappings, buildTimeConfiguration.crd.validate)));
decorators.produce(new DecoratorBuildItem(new AddRoleBindingsDecorator(configs, buildTimeConfiguration.crd.validate)));
}
Aggregations