Skip to content

Commit 2533afe

Browse files
committed
feat(operator/eos): Add disable flag
1 parent 82bcd6f commit 2533afe

File tree

1 file changed

+16
-1
lines changed
  • crates/stackable-operator/src/eos

1 file changed

+16
-1
lines changed

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)