Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce --timeout-fatal to control readiness timeouts #409

Merged
merged 3 commits into from
Dec 11, 2023
Merged
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
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