Skip to content

Commit

Permalink
feat: add config option for informerListLimit (#669)
Browse files Browse the repository at this point in the history

Co-authored-by: Chris Laprun <[email protected]>
  • Loading branch information
csviri and metacosm authored Aug 16, 2023
1 parent 73228c1 commit f78ab7f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ static QuarkusControllerConfiguration createConfiguration(
Class<?> retryConfigurationClass = null;
Class<? extends RateLimiter> rateLimiterClass = DefaultRateLimiter.class;
Class<?> rateLimiterConfigurationClass = null;
Long nullableInformerListLimit = null;
if (controllerAnnotation != null) {
final var intervalFromAnnotation = ConfigurationUtils.annotationValueOrDefault(
controllerAnnotation, "maxReconciliationInterval", AnnotationValue::asNested,
Expand Down Expand Up @@ -202,6 +203,9 @@ static QuarkusControllerConfiguration createConfiguration(
final var rateLimiterConfigurableInfo = configurableInfos.get(rateLimiterClass.getName());
rateLimiterConfigurationClass = getConfigurationAnnotationClass(reconcilerInfo,
rateLimiterConfigurableInfo);
nullableInformerListLimit = ConfigurationUtils.annotationValueOrDefault(
controllerAnnotation, "informerListLimit", AnnotationValue::asLong,
() -> null);
}

// extract the namespaces
Expand Down Expand Up @@ -249,6 +253,7 @@ static QuarkusControllerConfiguration createConfiguration(
primaryAsResource.version(),
configExtractor.generationAware(),
resourceClass,
nullableInformerListLimit,
namespaces,
wereNamespacesSet,
getFinalizer(controllerAnnotation, resourceFullName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public DefaultRateLimiter(Duration refreshPeriod, int limitForPeriod) {
private final boolean generationAware;
private final boolean statusPresentAndNotVoid;
private final Class<R> resourceClass;
private final Optional<Long> informerListLimit;
private final ResourceEventFilter<R> eventFilter;
private final Optional<Duration> maxReconciliationInterval;
private final Optional<OnAddFilter<? super R>> onAddFilter;
Expand Down Expand Up @@ -93,7 +94,9 @@ public QuarkusControllerConfiguration(
String name,
String resourceTypeName,
String crVersion, boolean generationAware,
Class resourceClass, Set<String> namespaces,
Class resourceClass,
Long nullableInformerListLimit,
Set<String> namespaces,
boolean wereNamespacesSet,
String finalizerName, String labelSelector,
boolean statusPresentAndNotVoid, ResourceEventFilter eventFilter,
Expand All @@ -109,6 +112,7 @@ public QuarkusControllerConfiguration(
this.crVersion = crVersion;
this.generationAware = generationAware;
this.resourceClass = resourceClass;
this.informerListLimit = Optional.ofNullable(nullableInformerListLimit);
this.dependentsMetadata = dependentsMetadata;
this.workflow = workflow;
this.retryConfiguration = ControllerConfiguration.super.getRetryConfiguration();
Expand Down Expand Up @@ -148,6 +152,17 @@ public Class<R> getResourceClass() {
return resourceClass;
}

@Override
public Optional<Long> getInformerListLimit() {
return informerListLimit;
}

@SuppressWarnings("unused")
// this is needed by Quarkus for the RecordableConstructor
public Long getNullableInformerListLimit() {
return informerListLimit.orElse(null);
}

@Override
public String getName() {
return name;
Expand Down

0 comments on commit f78ab7f

Please sign in to comment.