Closed
Description
The current gracefulshutdown support method is as follows.
public void stop(Duration gracefulShutdownTimeout) throws OperatorException {
if (!started) {
return;
}
log.info(
"Operator SDK {} is shutting down...", configurationService.getVersion().getSdkVersion());
controllerManager.stop();
configurationService.getExecutorServiceManager().stop(gracefulShutdownTimeout);
leaderElectionManager.stop();
if (configurationService.closeClientOnStop()) {
getKubernetesClient().close();
}
started = false;
}
Receiving timeoutseconds
as a method parameter has several disadvantages.
1. Difficult to utilize directly in spring boot
Difficult to pass parameters to bean destroy configuration
2. Sometimes graceful shutdown is not performed unintentionally
There are quite a few places that call the stop method, and I don't know if it was intentional, but in most cases, the terminateseconds setting is ignored.
Suggestion
@Override
public void stop() throws OperatorException {
int timeoutSeconds = configurationService.getTerminationTimeoutSeconds();
if (timeoutSeconds > 0) {
stop(Duration.ofSeconds(timeoutSeconds));
} else {
stop(Duration.ZERO);
}
}
configurationService.getTerminationTimeoutSeconds
I know the above setting is no longer supported, but
To solve the two problems above, I think it would be a good idea to continue supporting this setting.
Or any other good ideas?
Metadata
Metadata
Assignees
Labels
No labels