Skip to content

Commit

Permalink
Introduce --timeout-fatal to control readiness timeouts (#409)
Browse files Browse the repository at this point in the history
In some situations, it's desirable to allow linkerd-await to continue
running a command even when readiness cannot be established.

This change adds a --timeout-fatal argument to allow the default
behavior to be disabled (via --timeout-fatal=false).

Signed-off-by: Dan Levin <[email protected]>
Co-authored-by: Oliver Gould <[email protected]>
  • Loading branch information
cromulentbanana and olix0r authored Dec 11, 2023
1 parent ee98ab8 commit 7f29fda
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ struct Args {
)]
timeout: Option<time::Duration>,

#[clap(
long,
help = "Controls whether a readiness timeout failure prevents CMD from running",
default_value("true"),
default_missing_value("true"),
num_args(0..=1),
require_equals(true),
action = clap::ArgAction::Set,
requires("CMD")
)]
timeout_fatal: bool,

#[clap(name = "CMD", help = "The command to run after linkerd is ready")]
cmd: Option<String>,

Expand All @@ -68,6 +80,7 @@ async fn main() {
shutdown,
verbose,
timeout,
timeout_fatal,
cmd,
args,
} = Args::parse();
Expand Down Expand Up @@ -100,7 +113,13 @@ async fn main() {
"linkerd-proxy failed to become ready within {:?} timeout",
timeout
);
std::process::exit(EX_UNAVAILABLE)

// Continue running the command when timeouts are configured
// to be non-fatal.
if timeout_fatal {
std::process::exit(EX_UNAVAILABLE)
}

}
}
if shutdown {
Expand Down

0 comments on commit 7f29fda

Please sign in to comment.