-
Notifications
You must be signed in to change notification settings - Fork 218
feat: support for graceful shutdown based on configuration #2479
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
feat: support for graceful shutdown based on configuration #2479
Conversation
.withReconciliationTerminationTimeout(Duration.ofSeconds(5)); | ||
|
||
final var operator = new Operator(overridden); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, it is beneficial for users to be aware of this feature, so I have documented it.
However, in most users' cases, the graceful shutdown feature may not be necessary.
If you think this documentation is unnecessary, please let me know and I will remove it.
* @return The duration of time to wait before terminating the reconciliation threads | ||
*/ | ||
default Duration reconciliationTerminationTimeout() { | ||
return Duration.ZERO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default is immediate shutdown
@@ -28,7 +28,7 @@ public class GracefulStopIT { | |||
.build(); | |||
|
|||
@Test | |||
void stopsGracefullyWIthTimeout() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also corrected a typo in the method name while I was at it.
LocallyRunOperatorExtension operator = | ||
LocallyRunOperatorExtension.builder() | ||
.withConfigurationService(o -> o.withCloseClientOnStop(false) | ||
.withReconciliationTerminationTimeout(Duration.ofSeconds(RECONCILER_SLEEP))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.withReconciliationTerminationTimeout(Duration.ofMillis(RECONCILER_SLEEP)))
User can configure the graceful shutdown time in the Operator settings.
Support for graceful shutdown based on configuration Signed-off-by: 10000-ki <[email protected]> Fix naming Signed-off-by: 10000-ki <[email protected]> Fix lint error Signed-off-by: 10000-ki <[email protected]> Fix lint error Signed-off-by: 10000-ki <[email protected]> Fix lint error Signed-off-by: 10000-ki <[email protected]> Fix test duration Signed-off-by: 10000-ki <[email protected]>
@csviri Configuration-based graceful shutdown can be difficult to modify at runtime, so supporting features like However, from an actual user's perspective, it doesn't seem very beneficial. It might be clearer to specify the graceful shutdown timeout value when setting up the Operator Configuration Personally, I think it's fine to no longer support it, but there may be users using it in previous versions. Therefore, I didn't make any changes to it in this PR. Should we mark it as deprecated?? |
...ramework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java
Show resolved
Hide resolved
Signed-off-by: 10000-ki <[email protected]>
Signed-off-by: 10000-ki <[email protected]>
Signed-off-by: 10000-ki <[email protected]>
Thank you! |
Awesome, thank you! |
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
--------- Signed-off-by: 10000-ki <[email protected]>
resolved: #2476
What i am working on in this PR
stop
method.