Skip to content

Commit 239b900

Browse files
authored
feat(operator/eos): Add disable flag (#1101)
* feat(operator/eos): Add disable flag * chore(operator): Add changelog entry
1 parent 82bcd6f commit 239b900

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

crates/stackable-operator/CHANGELOG.md

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

77
### Added
88

9+
- Add CLI argument and env var to disable the end-of-support checker: `EOS_DISABLED` (`--eos-disabled`) ([#1101]).
910
- Add end-of-support checker ([#1096]).
1011
- The EoS checker can be constructed using `EndOfSupportChecker::new()`.
1112
- Add new `MaintenanceOptions` and `EndOfSupportOptions` structs.
@@ -24,6 +25,7 @@ All notable changes to this project will be documented in this file.
2425

2526
[#1096]: https://github.com/stackabletech/operator-rs/pull/1096
2627
[#1098]: https://github.com/stackabletech/operator-rs/pull/1098
28+
[#1101]: https://github.com/stackabletech/operator-rs/pull/1101
2729

2830
## [0.98.0] - 2025-09-22
2931

crates/stackable-operator/src/eos/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ pub struct EndOfSupportOptions {
2727
))]
2828
pub interval: Duration,
2929

30+
/// If the end-of-support check should be disabled entirely.
31+
#[cfg_attr(feature = "clap", arg(long = "eos-disabled", env = "EOS_DISABLED"))]
32+
pub disabled: bool,
33+
3034
/// The support duration (how long the operator should be considered supported after
3135
/// it's built-date).
3236
///
@@ -65,6 +69,7 @@ pub enum Error {
6569
pub struct EndOfSupportChecker {
6670
datetime: DateTime<Utc>,
6771
interval: Duration,
72+
disabled: bool,
6873
}
6974

7075
impl EndOfSupportChecker {
@@ -79,6 +84,7 @@ impl EndOfSupportChecker {
7984
let EndOfSupportOptions {
8085
interval,
8186
support_duration,
87+
disabled,
8288
..
8389
} = options;
8490

@@ -95,14 +101,23 @@ impl EndOfSupportChecker {
95101
// Add the support duration to the built date. This marks the end-of-support date.
96102
datetime += *support_duration;
97103

98-
Ok(Self { datetime, interval })
104+
Ok(Self {
105+
datetime,
106+
interval,
107+
disabled,
108+
})
99109
}
100110

101111
/// Run the end-of-support checker.
102112
///
103113
/// It is recommended to run the end-of-support checker via [`futures::try_join!`] or
104114
/// [`tokio::join`] alongside other futures (eg. for controllers).
105115
pub async fn run(self) {
116+
// Immediately return if the end-of-support checker is disabled.
117+
if self.disabled {
118+
return;
119+
}
120+
106121
// Construct an interval which can be polled.
107122
let mut interval = tokio::time::interval(self.interval.into());
108123

0 commit comments

Comments
 (0)