diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java index 9f25b47f49..ae836f2a72 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java @@ -139,6 +139,10 @@ protected

ControllerConfiguration

configFor(Reconcile annotation.fieldManager().equals(CONTROLLER_NAME_AS_FIELD_MANAGER) ? name : annotation.fieldManager(); + final var informerListLimit = + annotation.informerListLimit() == Constants.NO_LONG_VALUE_SET ? null + : annotation.informerListLimit(); + final var config = new ResolvedControllerConfiguration

( resourceClass, name, generationAware, associatedReconcilerClass, retry, rateLimiter, @@ -157,8 +161,7 @@ protected

ControllerConfiguration

configFor(Reconcile Constants.NO_VALUE_SET), null, Utils.instantiate(annotation.itemStore(), ItemStore.class, context), dependentFieldManager, - this, - null); + this, informerListLimit); ResourceEventFilter

answer = deprecatedEventFilter(annotation); config.setEventFilter(answer != null ? answer : ResourceEventFilters.passthrough()); diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java index 08aeb16f90..9876fda558 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java @@ -14,6 +14,7 @@ public final class Constants { Collections.singleton(Constants.SAME_AS_CONTROLLER); public static final String NO_VALUE_SET = ""; + public static final long NO_LONG_VALUE_SET = -1L; public static final String WATCH_CURRENT_NAMESPACE = "JOSDK_WATCH_CURRENT"; public static final String WATCH_ALL_NAMESPACES = "JOSDK_ALL_NAMESPACES"; diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java index 1cd7ed6306..c064e669e0 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java @@ -19,6 +19,7 @@ import io.javaoperatorsdk.operator.processing.retry.Retry; import static io.javaoperatorsdk.operator.api.config.ControllerConfiguration.CONTROLLER_NAME_AS_FIELD_MANAGER; +import static io.javaoperatorsdk.operator.api.reconciler.Constants.NO_LONG_VALUE_SET; @Inherited @Retention(RetentionPolicy.RUNTIME) @@ -158,4 +159,11 @@ MaxReconciliationInterval maxReconciliationInterval() default @MaxReconciliation * @return the name used as field manager for SSA operations */ String fieldManager() default CONTROLLER_NAME_AS_FIELD_MANAGER; + + /** + * The maximum amount of items to return for a single list call when starting the primary resource + * related informers. If this is a not null it will result in paginating for the initial load of + * the informer cache. + */ + long informerListLimit() default NO_LONG_VALUE_SET; }