diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/ConfigurationServiceRecorder.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/ConfigurationServiceRecorder.java index 59cc9e5e7..4f8be8f14 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/ConfigurationServiceRecorder.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/ConfigurationServiceRecorder.java @@ -25,7 +25,7 @@ public class ConfigurationServiceRecorder { static final Logger log = Logger.getLogger(ConfigurationServiceRecorder.class.getName()); - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({ "rawtypes" }) public Supplier configurationServiceSupplier(Version version, Map configurations, CRDGenerationInfo crdInfo, RunTimeOperatorConfiguration runTimeConfiguration, @@ -33,7 +33,7 @@ public Supplier configurationServiceSupplier(Versio final var maxThreads = runTimeConfiguration.concurrentReconciliationThreads .orElse(ConfigurationService.DEFAULT_RECONCILIATION_THREADS_NUMBER); final var timeout = runTimeConfiguration.terminationTimeoutSeconds - .orElse(ConfigurationService.DEFAULT_TERMINATION_TIMEOUT_SECONDS); + .orElse(QuarkusConfigurationService.UNSET_TERMINATION_TIMEOUT_SECONDS); final var workflowThreads = runTimeConfiguration.concurrentWorkflowThreads .orElse(ConfigurationService.DEFAULT_WORKFLOW_EXECUTOR_THREAD_NUMBER); final var cacheSyncTimeout = runTimeConfiguration.cacheSyncTimeout; diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/OperatorProducer.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/OperatorProducer.java index 0c3e832be..513733d7e 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/OperatorProducer.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/OperatorProducer.java @@ -2,6 +2,8 @@ import static io.quarkiverse.operatorsdk.runtime.CRDUtils.applyCRD; +import java.time.Duration; + import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Instance; import jakarta.enterprise.inject.Produces; @@ -34,8 +36,7 @@ public class OperatorProducer { @DefaultBean @ApplicationScoped Operator operator(QuarkusConfigurationService configuration, Instance> reconcilers) { - if (configuration.getVersion() instanceof Version) { - final var version = ((Version) configuration.getVersion()); + if (configuration.getVersion() instanceof Version version) { log.info("Quarkus Java Operator SDK extension {}", version.getExtensionCompleteVersion()); } @@ -52,6 +53,12 @@ Operator operator(QuarkusConfigurationService configuration, Instance>, ManagedWorkflowFactory> { private static final Logger log = LoggerFactory.getLogger(QuarkusConfigurationService.class); + public static final int UNSET_TERMINATION_TIMEOUT_SECONDS = -1; private final CRDGenerationInfo crdInfo; private final int concurrentReconciliationThreads; private final int terminationTimeout; @@ -129,7 +130,6 @@ public int concurrentReconciliationThreads() { return this.concurrentReconciliationThreads; } - @Override public int getTerminationTimeoutSeconds() { return terminationTimeout; } diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/RunTimeOperatorConfiguration.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/RunTimeOperatorConfiguration.java index 41c9d8167..3ed2f8c2b 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/RunTimeOperatorConfiguration.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/RunTimeOperatorConfiguration.java @@ -42,7 +42,10 @@ public class RunTimeOperatorConfiguration { public Optional concurrentReconciliationThreads; /** - * Amount of seconds the SDK waits for reconciliation threads to terminate before shutting down. + * Amount of seconds the SDK waits for reconciliation threads to terminate before shutting down. Setting this value will + * install a shutdown hook to wait for termination (causing + * {@link io.javaoperatorsdk.operator.Operator#installShutdownHook(Duration)} to be called with + * `Duration.ofSeconds(terminationTimeoutSeconds)`). */ @ConfigItem public Optional terminationTimeoutSeconds; diff --git a/docs/modules/ROOT/pages/includes/quarkus-operator-sdk.adoc b/docs/modules/ROOT/pages/includes/quarkus-operator-sdk.adoc index 78c8b17b3..ca812ab24 100644 --- a/docs/modules/ROOT/pages/includes/quarkus-operator-sdk.adoc +++ b/docs/modules/ROOT/pages/includes/quarkus-operator-sdk.adoc @@ -344,7 +344,7 @@ a| [[quarkus-operator-sdk_quarkus-operator-sdk-termination-timeout-seconds]]`lin [.description] -- -Amount of seconds the SDK waits for reconciliation threads to terminate before shutting down. +Amount of seconds the SDK waits for reconciliation threads to terminate before shutting down. Setting this value will install a shutdown hook to wait for termination (causing `io.javaoperatorsdk.operator.Operator++#++installShutdownHook(Duration)` to be called with `Duration.ofSeconds(terminationTimeoutSeconds)`). ifdef::add-copy-button-to-env-var[] Environment variable: env_var_with_copy_button:+++QUARKUS_OPERATOR_SDK_TERMINATION_TIMEOUT_SECONDS+++[]