Skip to content

Commit 5efef6b

Browse files
authored
feat: Add graceful shutdown (#1004)
* feat: Add graceful shutdown * chore: Update CRD documentation * chore: Bump bytes crate to 1.11.1 Fixes RUSTSEC-2026-0007. * chore: Bump git2 crate to 0.20.4 Fixes RUSTSEC-2026-0008. * chore: Add changelog entry
1 parent 29379e6 commit 5efef6b

File tree

7 files changed

+60
-50
lines changed

7 files changed

+60
-50
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ All notable changes to this project will be documented in this file.
1111
See [objectOverrides concepts page](https://docs.stackable.tech/home/nightly/concepts/overrides/#object-overrides) for details ([#987]).
1212
- Enable the [restart-controller](https://docs.stackable.tech/home/nightly/commons-operator/restarter/), so that the Pods are automatically restarted on config changes ([#999]).
1313

14+
### Changed
15+
16+
- Gracefully shutdown all concurrent tasks by forwarding the SIGTERM signal ([#1004]).
17+
1418
### Removed
1519

1620
- Remove support for ZooKeeper 3.9.3 ([#1001]).
@@ -19,6 +23,7 @@ All notable changes to this project will be documented in this file.
1923
[#988]: https://github.com/stackabletech/zookeeper-operator/pull/988
2024
[#999]: https://github.com/stackabletech/zookeeper-operator/pull/999
2125
[#1001]: https://github.com/stackabletech/zookeeper-operator/pull/1001
26+
[#1004]: https://github.com/stackabletech/zookeeper-operator/pull/1004
2227

2328
## [25.11.0] - 2025-11-07
2429

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/zookeeper-operator"
1111

1212
[workspace.dependencies]
1313
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.8.0" }
14-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.102.0", features = ["telemetry", "versioned"] }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.105.0", features = ["telemetry", "versioned"] }
1515

1616
anyhow = "1.0"
1717
built = { version = "0.8", features = ["chrono", "git2"] }

crate-hashes.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/helm/zookeeper-operator/crds/crds.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ spec:
531531
default: {}
532532
description: |-
533533
In the `podOverrides` property you can define a
534-
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core)
534+
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core)
535535
to override any property that can be set on a Kubernetes Pod.
536536
Read the
537537
[Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides)
@@ -905,7 +905,7 @@ spec:
905905
default: {}
906906
description: |-
907907
In the `podOverrides` property you can define a
908-
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core)
908+
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core)
909909
to override any property that can be set on a Kubernetes Pod.
910910
Read the
911911
[Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides)

rust/operator-binary/src/main.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use stackable_operator::{
3030
logging::controller::report_controller_reconciled,
3131
shared::yaml::SerializeOptions,
3232
telemetry::Tracing,
33+
utils::signal::SignalWatcher,
3334
};
3435

3536
use crate::{zk_controller::ZK_FULL_CONTROLLER_NAME, znode_controller::ZNODE_FULL_CONTROLLER_NAME};
@@ -91,9 +92,13 @@ async fn main() -> anyhow::Result<()> {
9192
description = built_info::PKG_DESCRIPTION
9293
);
9394

95+
// Watches for the SIGTERM signal and sends a signal to all receivers, which gracefully
96+
// shuts down all concurrent tasks below (EoS checker, controller).
97+
let sigterm_watcher = SignalWatcher::sigterm()?;
98+
9499
let eos_checker =
95100
EndOfSupportChecker::new(built_info::BUILT_TIME_UTC, maintenance.end_of_support)?
96-
.run()
101+
.run(sigterm_watcher.handle())
97102
.map(anyhow::Ok);
98103

99104
let product_config = product_config.load(&[
@@ -132,7 +137,7 @@ async fn main() -> anyhow::Result<()> {
132137
watch_namespace.get_api::<DeserializeGuard<ConfigMap>>(&client),
133138
watcher::Config::default(),
134139
)
135-
.shutdown_on_signal()
140+
.graceful_shutdown_on(sigterm_watcher.handle())
136141
.run(
137142
zk_controller::reconcile_zk,
138143
zk_controller::error_policy,
@@ -197,7 +202,7 @@ async fn main() -> anyhow::Result<()> {
197202
.map(|znode| ObjectRef::from_obj(&*znode))
198203
},
199204
)
200-
.shutdown_on_signal()
205+
.graceful_shutdown_on(sigterm_watcher.handle())
201206
.run(
202207
znode_controller::reconcile_znode,
203208
znode_controller::error_policy,

0 commit comments

Comments
 (0)