Skip to content

Commit b66ef93

Browse files
authored
fix: add informer limit also to the annotation (#2004)
1 parent 3b72bb4 commit b66ef93

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ protected <P extends HasMetadata> ControllerConfiguration<P> configFor(Reconcile
139139
annotation.fieldManager().equals(CONTROLLER_NAME_AS_FIELD_MANAGER) ? name
140140
: annotation.fieldManager();
141141

142+
final var informerListLimit =
143+
annotation.informerListLimit() == Constants.NO_LONG_VALUE_SET ? null
144+
: annotation.informerListLimit();
145+
142146
final var config = new ResolvedControllerConfiguration<P>(
143147
resourceClass, name, generationAware,
144148
associatedReconcilerClass, retry, rateLimiter,
@@ -157,8 +161,7 @@ protected <P extends HasMetadata> ControllerConfiguration<P> configFor(Reconcile
157161
Constants.NO_VALUE_SET),
158162
null,
159163
Utils.instantiate(annotation.itemStore(), ItemStore.class, context), dependentFieldManager,
160-
this,
161-
null);
164+
this, informerListLimit);
162165

163166
ResourceEventFilter<P> answer = deprecatedEventFilter(annotation);
164167
config.setEventFilter(answer != null ? answer : ResourceEventFilters.passthrough());

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public final class Constants {
1414
Collections.singleton(Constants.SAME_AS_CONTROLLER);
1515

1616
public static final String NO_VALUE_SET = "";
17+
public static final long NO_LONG_VALUE_SET = -1L;
1718
public static final String WATCH_CURRENT_NAMESPACE = "JOSDK_WATCH_CURRENT";
1819
public static final String WATCH_ALL_NAMESPACES = "JOSDK_ALL_NAMESPACES";
1920

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.javaoperatorsdk.operator.processing.retry.Retry;
2020

2121
import static io.javaoperatorsdk.operator.api.config.ControllerConfiguration.CONTROLLER_NAME_AS_FIELD_MANAGER;
22+
import static io.javaoperatorsdk.operator.api.reconciler.Constants.NO_LONG_VALUE_SET;
2223

2324
@Inherited
2425
@Retention(RetentionPolicy.RUNTIME)
@@ -158,4 +159,11 @@ MaxReconciliationInterval maxReconciliationInterval() default @MaxReconciliation
158159
* @return the name used as field manager for SSA operations
159160
*/
160161
String fieldManager() default CONTROLLER_NAME_AS_FIELD_MANAGER;
162+
163+
/**
164+
* The maximum amount of items to return for a single list call when starting the primary resource
165+
* related informers. If this is a not null it will result in paginating for the initial load of
166+
* the informer cache.
167+
*/
168+
long informerListLimit() default NO_LONG_VALUE_SET;
161169
}

0 commit comments

Comments
 (0)