Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.

### Added

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

[#1096]: https://github.com/stackabletech/operator-rs/pull/1096
[#1098]: https://github.com/stackabletech/operator-rs/pull/1098
[#1101]: https://github.com/stackabletech/operator-rs/pull/1101

## [0.98.0] - 2025-09-22

Expand Down
17 changes: 16 additions & 1 deletion crates/stackable-operator/src/eos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ pub struct EndOfSupportOptions {
))]
pub interval: Duration,

/// If the end-of-support check should be disabled entirely.
#[cfg_attr(feature = "clap", arg(long = "eos-disabled", env = "EOS_DISABLED"))]
pub disabled: bool,

/// The support duration (how long the operator should be considered supported after
/// it's built-date).
///
Expand Down Expand Up @@ -65,6 +69,7 @@ pub enum Error {
pub struct EndOfSupportChecker {
datetime: DateTime<Utc>,
interval: Duration,
disabled: bool,
}

impl EndOfSupportChecker {
Expand All @@ -79,6 +84,7 @@ impl EndOfSupportChecker {
let EndOfSupportOptions {
interval,
support_duration,
disabled,
..
} = options;

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

Ok(Self { datetime, interval })
Ok(Self {
datetime,
interval,
disabled,
})
}

/// Run the end-of-support checker.
///
/// It is recommended to run the end-of-support checker via [`futures::try_join!`] or
/// [`tokio::join`] alongside other futures (eg. for controllers).
pub async fn run(self) {
// Immediately return if the end-of-support checker is disabled.
if self.disabled {
return;
}

// Construct an interval which can be polled.
let mut interval = tokio::time::interval(self.interval.into());

Expand Down