-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support graceful shutdown (#487)
* feat: Support graceful shutdown * disable OPA telemetry * Add docs * changelog * Update docs/modules/opa/pages/usage-guide/operations/graceful-shutdown.adoc Co-authored-by: Malte Sander <contact@maltesander.com> --------- Co-authored-by: Malte Sander <contact@maltesander.com>
- Loading branch information
1 parent
be4a79e
commit 11c7814
Showing
13 changed files
with
189 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 23 additions & 4 deletions
27
docs/modules/opa/pages/usage-guide/operations/graceful-shutdown.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
= Graceful shutdown | ||
|
||
Graceful shutdown of OPA nodes is either not supported by the product itself | ||
or we have not implemented it yet. | ||
You can configure the graceful shutdown as described in xref:concepts:operations/graceful_shutdown.adoc[]. | ||
|
||
Outstanding implementation work for the graceful shutdowns of all products where this functionality is relevant is tracked in | ||
https://github.com/stackabletech/issues/issues/357 | ||
== Servers | ||
|
||
As a default, OPA servers have `2 minutes` to shut down gracefully. | ||
|
||
The OPA server process will receive a `SIGTERM` signal when Kubernetes wants to terminate the Pod. | ||
It will acknowledge the shutdown as shown in the log below and initiate a graceful shutdown. | ||
After the graceful shutdown timeout runs out, and the process still didn't exit, Kubernetes will issue a `SIGKILL` signal. | ||
|
||
[source,text] | ||
---- | ||
{"level":"info","msg":"Shutting down...","time":"2023-11-06T15:16:08Z"} | ||
{"level":"info","msg":"Server shutdown.","time":"2023-11-06T15:16:08Z"} | ||
{"level":"info","msg":"Stopping bundle loader.","name":"stackable","plugin":"bundle","time":"2023-11-06T15:16:08Z"} | ||
---- | ||
|
||
== Implementation | ||
|
||
Once a server Pod is asked to terminate the following timeline occurs: | ||
|
||
1. The server stops accepting any new queries. | ||
2. The server waits until all running queries have finished. | ||
3. If the graceful shutdown doesn't complete quick enough (e.g. a query runs longer than the graceful shutdown period), after `<graceful shutdown period> + 5s safety overhead` the Pod gets killed, regardless if it has shut down gracefully or not. This is achieved by setting `terminationGracePeriodSeconds` on the server Pods. Running queries on the sever will fail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.