Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add informer limit also to the annotation #2004

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ protected <P extends HasMetadata> ControllerConfiguration<P> 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<P>(
resourceClass, name, generationAware,
associatedReconcilerClass, retry, rateLimiter,
Expand All @@ -157,8 +161,7 @@ protected <P extends HasMetadata> ControllerConfiguration<P> configFor(Reconcile
Constants.NO_VALUE_SET),
null,
Utils.instantiate(annotation.itemStore(), ItemStore.class, context), dependentFieldManager,
this,
null);
this, informerListLimit);

ResourceEventFilter<P> answer = deprecatedEventFilter(annotation);
config.setEventFilter(answer != null ? answer : ResourceEventFilters.passthrough());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Loading