Skip to content

Commit

Permalink
feat: allow configuration of an ExecutorService / Metrics (#14) (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: kroonprins <[email protected]>
  • Loading branch information
kroonprins and kroonprins authored Mar 15, 2022
1 parent 6f83867 commit 9f90352
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutorService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -25,6 +26,7 @@
import io.javaoperatorsdk.operator.api.config.AbstractConfigurationService;
import io.javaoperatorsdk.operator.api.config.RetryConfiguration;
import io.javaoperatorsdk.operator.api.config.Utils;
import io.javaoperatorsdk.operator.api.monitoring.Metrics;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
import io.javaoperatorsdk.operator.config.runtime.AnnotationConfiguration;

Expand Down Expand Up @@ -96,6 +98,18 @@ public Operator operator(
return operator;
}

@Bean
@ConditionalOnMissingBean(name = "reconciliationExecutorService")
public ExecutorService reconciliationExecutorService() {
return super.getExecutorService();
}

@Bean
@ConditionalOnMissingBean(Metrics.class)
public Metrics metrics() {
return super.getMetrics();
}

private Reconciler<?> processReconciler(
Reconciler<?> reconciler, ResourceClassResolver resourceClassResolver) {
final var reconcilerPropertiesMap = configuration.getReconcilers();
Expand Down Expand Up @@ -162,6 +176,16 @@ public RetryConfiguration getRetryConfiguration() {
}
}

@Override
public Metrics getMetrics() {
return metrics();
}

@Override
public ExecutorService getExecutorService() {
return reconciliationExecutorService();
}

@Override
public int concurrentReconciliationThreads() {
return configuration.getConcurrentReconciliationThreads();
Expand Down

0 comments on commit 9f90352

Please sign in to comment.