Skip to content

Commit db68b4b

Browse files
authored
feat: Add graceful shutdown (#670)
* feat: Add graceful shutdown * chore: Update CRD documentation * chore: Add changelog entry * chore: Bump bytes crate to 1.11.1 Fixes RUSTSEC-2026-0007.
1 parent af08482 commit db68b4b

File tree

7 files changed

+47
-40
lines changed

7 files changed

+47
-40
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
1414

1515
### Changed
1616

17+
- Gracefully shutdown all concurrent tasks by forwarding the SIGTERM signal ([#670]).
1718
- Bump testing-tools to `0.3.0-stackable0.0.0-dev` ([#664]).
1819
- Deprecate support for `4.1.0` ([#668]).
1920

@@ -22,6 +23,7 @@ All notable changes to this project will be documented in this file.
2223
[#665]: https://github.com/stackabletech/hive-operator/pull/665
2324
[#666]: https://github.com/stackabletech/hive-operator/pull/666
2425
[#668]: https://github.com/stackabletech/hive-operator/pull/668
26+
[#670]: https://github.com/stackabletech/hive-operator/pull/670
2527

2628
## [25.11.0] - 2025-11-07
2729

Cargo.lock

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

Cargo.nix

Lines changed: 18 additions & 18 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/hive-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/hive-operator/crds/crds.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ spec:
679679
default: {}
680680
description: |-
681681
In the `podOverrides` property you can define a
682-
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core)
682+
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core)
683683
to override any property that can be set on a Kubernetes Pod.
684684
Read the
685685
[Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides)
@@ -1035,7 +1035,7 @@ spec:
10351035
default: {}
10361036
description: |-
10371037
In the `podOverrides` property you can define a
1038-
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#podtemplatespec-v1-core)
1038+
[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#podtemplatespec-v1-core)
10391039
to override any property that can be set on a Kubernetes Pod.
10401040
Read the
10411041
[Pod overrides documentation](https://docs.stackable.tech/home/nightly/concepts/overrides#pod-overrides)

rust/operator-binary/src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use stackable_operator::{
3838
logging::controller::report_controller_reconciled,
3939
shared::yaml::SerializeOptions,
4040
telemetry::Tracing,
41+
utils::signal::SignalWatcher,
4142
};
4243

4344
use crate::{
@@ -88,9 +89,13 @@ async fn main() -> anyhow::Result<()> {
8889
description = built_info::PKG_DESCRIPTION
8990
);
9091

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

96101
let product_config = product_config.load(&[
@@ -129,7 +134,6 @@ async fn main() -> anyhow::Result<()> {
129134
watch_namespace.get_api::<ConfigMap>(&client),
130135
watcher::Config::default(),
131136
)
132-
.shutdown_on_signal()
133137
.watches(
134138
watch_namespace.get_api::<DeserializeGuard<ConfigMap>>(&client),
135139
watcher::Config::default(),
@@ -141,6 +145,7 @@ async fn main() -> anyhow::Result<()> {
141145
.map(|hive| ObjectRef::from_obj(&*hive))
142146
},
143147
)
148+
.graceful_shutdown_on(sigterm_watcher.handle())
144149
.run(
145150
controller::reconcile_hive,
146151
controller::error_policy,

0 commit comments

Comments
 (0)