File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
crates/stackable-operator/src/eos Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ pub struct EndOfSupportOptions {
27
27
) ) ]
28
28
pub interval : Duration ,
29
29
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
+
30
34
/// The support duration (how long the operator should be considered supported after
31
35
/// it's built-date).
32
36
///
@@ -65,6 +69,7 @@ pub enum Error {
65
69
pub struct EndOfSupportChecker {
66
70
datetime : DateTime < Utc > ,
67
71
interval : Duration ,
72
+ disabled : bool ,
68
73
}
69
74
70
75
impl EndOfSupportChecker {
@@ -79,6 +84,7 @@ impl EndOfSupportChecker {
79
84
let EndOfSupportOptions {
80
85
interval,
81
86
support_duration,
87
+ disabled,
82
88
..
83
89
} = options;
84
90
@@ -95,14 +101,23 @@ impl EndOfSupportChecker {
95
101
// Add the support duration to the built date. This marks the end-of-support date.
96
102
datetime += * support_duration;
97
103
98
- Ok ( Self { datetime, interval } )
104
+ Ok ( Self {
105
+ datetime,
106
+ interval,
107
+ disabled,
108
+ } )
99
109
}
100
110
101
111
/// Run the end-of-support checker.
102
112
///
103
113
/// It is recommended to run the end-of-support checker via [`futures::try_join!`] or
104
114
/// [`tokio::join`] alongside other futures (eg. for controllers).
105
115
pub async fn run ( self ) {
116
+ // Immediately return if the end-of-support checker is disabled.
117
+ if self . disabled {
118
+ return ;
119
+ }
120
+
106
121
// Construct an interval which can be polled.
107
122
let mut interval = tokio:: time:: interval ( self . interval . into ( ) ) ;
108
123
You can’t perform that action at this time.
0 commit comments