-
-
Notifications
You must be signed in to change notification settings - Fork 9
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 (#740)
* feat: Support graceful shutdown * docs * changelog * Update docs/modules/zookeeper/pages/usage_guide/operations/graceful-shutdown.adoc Co-authored-by: Malte Sander <contact@maltesander.com> * Use formatdoc! * Update docs/modules/zookeeper/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
5a472ee
commit c930bd2
Showing
11 changed files
with
113 additions
and
16 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
15 changes: 11 additions & 4 deletions
15
docs/modules/zookeeper/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,14 @@ | ||
= Graceful shutdown | ||
|
||
Graceful shutdown of Zookeeper 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[]. | ||
|
||
The efforts of implementing graceful shutdown for all products that have this functionality is tracked in | ||
https://github.com/stackabletech/issues/issues/357 | ||
== Servers | ||
|
||
As a default, ZooKeeper servers have `2 minutes` to shut down gracefully. | ||
|
||
The ZooKeeper server process will receive a `SIGTERM` signal when Kubernetes wants to terminate the Pod. | ||
After the graceful shutdown timeout runs out, and the process still didn't exit, Kubernetes will issue a `SIGKILL` signal. | ||
|
||
This is equivalent to executing the `bin/zkServer.sh stop` command, which internally executes `kill <zookeeper-pid>` (https://github.com/apache/zookeeper/blob/74db005175a4ec545697012f9069cb9dcc8cdda7/bin/zkServer.sh#L219[code]). | ||
|
||
However, there is no acknowledge message in the log indicating a graceful shutdown. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use snafu::{ResultExt, Snafu}; | ||
use stackable_operator::builder::PodBuilder; | ||
use stackable_zookeeper_crd::ZookeeperConfig; | ||
|
||
#[derive(Debug, Snafu)] | ||
pub enum Error { | ||
#[snafu(display("Failed to set terminationGracePeriod"))] | ||
SetTerminationGracePeriod { | ||
source: stackable_operator::builder::pod::Error, | ||
}, | ||
} | ||
|
||
pub fn add_graceful_shutdown_config( | ||
merged_config: &ZookeeperConfig, | ||
pod_builder: &mut PodBuilder, | ||
) -> Result<(), Error> { | ||
// This must be always set by the merge mechanism, as we provide a default value, | ||
// users can not disable graceful shutdown. | ||
if let Some(graceful_shutdown_timeout) = merged_config.graceful_shutdown_timeout { | ||
pod_builder | ||
.termination_grace_period(&graceful_shutdown_timeout) | ||
.context(SetTerminationGracePeriodSnafu)?; | ||
} | ||
|
||
Ok(()) | ||
} |
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 +1,2 @@ | ||
pub mod graceful_shutdown; | ||
pub mod pdb; |
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