Search in sources :

Example 1 with DecoratorBuildItem

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)));
}
Also used : DecoratorBuildItem(io.quarkus.kubernetes.spi.DecoratorBuildItem) HashMap(java.util.HashMap) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

BuildStep (io.quarkus.deployment.annotations.BuildStep)1 DecoratorBuildItem (io.quarkus.kubernetes.spi.DecoratorBuildItem)1 HashMap (java.util.HashMap)1