-
Notifications
You must be signed in to change notification settings - Fork 270
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
admin: Add a /shutdown endpoint #811
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some applications, namely batch jobs, may prefer to manually signal that the proxy should terminate instead of relying on a SIGTERM. There's no good way for one container to send signals to another, though; so we need an admin endpoint to support shutdown. This change adds a `/shutdown` endpoint to the proxy's admin server that can be used to cause the proxy to initiate shutdown. Shutdown requests must come on the loopback interface (i.e. from within the same Kubernetes pod).
olix0r
added a commit
to linkerd/linkerd-await
that referenced
this pull request
Dec 27, 2020
When the --shutdown flag is provided, the specified command is forked (instead of simply exec'd) and the linkerd-await program forwards SIGTERM to the child process. When the child process completes, the proxy is shutdown via its admin interface. Depends on linkerd/linkerd2-proxy#811
hawkw
approved these changes
Dec 28, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
olix0r
added a commit
to linkerd/linkerd-await
that referenced
this pull request
Dec 29, 2020
When the --shutdown flag is provided, the specified command is forked (instead of simply exec'd) and the linkerd-await program forwards SIGTERM to the child process. When the child process completes, the proxy is shutdown via its admin interface. This behavior only operates as expected with as-of-yet unreleased proxy versions that support the /shutdown admin endpoint (linkerd/linkerd2-proxy#811). On prior versions, The /shutdown call will not succeed and the proxy will remain running. This change also introduces a 5s ready request timeout so that readiness requests cannot stall indefinitely.
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
Jan 6, 2021
This release adds a new `/shutdown` admin endpoint that may only be accessed over the loopback network. This allows batch jobs to gracefully terminate the proxy on completion. The `linkerd-await` utility can be used to automate this. This release also includes ~33 non-user-facing changes, the most important of which updates the Linkerd Transport Header preface to be `transport.l5d.io/v1\r\n\r\n`. --- * Simplify orig_proto::Downgrade intializaiton (linkerd/linkerd2-proxy#796) * Remove unused make_response module (linkerd/linkerd2-proxy#792) * Add MakeNormalizeUri::layer helper (linkerd/linkerd2-proxy#794) * Simplify tcp::Forward stack initialization (linkerd/linkerd2-proxy#797) * Add a NewServeHttp::layer helper (linkerd/linkerd2-proxy#793) * Simplify outbound endpoint stakc creation (linkerd/linkerd2-proxy#798) * Simplify NewRouter initialization (linkerd/linkerd2-proxy#795) * Remove unused http::add_header module (linkerd/linkerd2-proxy#800) * Simplify concurrency-limit initialization (linkerd/linkerd2-proxy#799) * Remove the strip_header::Layer type (linkerd/linkerd2-proxy#801) * Simplify http-classify stack initialization (linkerd/linkerd2-proxy#804) * Simplify HTTP metrics initialization (linkerd/linkerd2-proxy#806) * Add checks to ensure support for opaque transport (linkerd/linkerd2-proxy#808) * Remove the override_authority::Layer type (linkerd/linkerd2-proxy#802) * Simplify tls::client module (linkerd/linkerd2-proxy#809) * Simplify header_from_target stack initialization (linkerd/linkerd2-proxy#803) * Cleanup HTTP boxing modules (linkerd/linkerd2-proxy#805) * Include scope names in failfast error messages (linkerd/linkerd2-proxy#791) * Simplify drain module implementation (linkerd/linkerd2-proxy#810) * Simplify BoxNewService initialization (linkerd/linkerd2-proxy#807) * admin: Add a /shutdown endpoint (linkerd/linkerd2-proxy#811) * stack: Remove the MakeReady helper (linkerd/linkerd2-proxy#813) * Remove the stack::Oneshot helper (linkerd/linkerd2-proxy#812) * http: Simplify http::boxed type references (linkerd/linkerd2-proxy#814) * Simplify stack type constraints (linkerd/linkerd2-proxy#815) * Rename transport types to ConnectTcp and BindTcp (linkerd/linkerd2-proxy#819) * Remove box from inbound connector (linkerd/linkerd2-proxy#816) * tap: Simplify tap initialization (linkerd/linkerd2-proxy#820) * Update Rust to 1.49.0 (linkerd/linkerd2-proxy#822) * Avoid boxing I/O types for optional TLS (linkerd/linkerd2-proxy#817) * Decouple TLS detection from TCP connections (linkerd/linkerd2-proxy#818) * stack: Rename NewOptional to NewUnwrapOr (linkerd/linkerd2-proxy#824) * inbound: Decouple inbound stack from TCP connections (linkerd/linkerd2-proxy#823) * Rename opaque-transport to transport-header (linkerd/linkerd2-proxy#825)
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
Jan 6, 2021
This release adds a new `/shutdown` admin endpoint that may only be accessed over the loopback network. This allows batch jobs to gracefully terminate the proxy on completion. The `linkerd-await` utility can be used to automate this. This release also includes ~33 non-user-facing changes, the most important of which updates the Linkerd Transport Header preface to be `transport.l5d.io/v1\r\n\r\n`. --- * Simplify orig_proto::Downgrade intializaiton (linkerd/linkerd2-proxy#796) * Remove unused make_response module (linkerd/linkerd2-proxy#792) * Add MakeNormalizeUri::layer helper (linkerd/linkerd2-proxy#794) * Simplify tcp::Forward stack initialization (linkerd/linkerd2-proxy#797) * Add a NewServeHttp::layer helper (linkerd/linkerd2-proxy#793) * Simplify outbound endpoint stakc creation (linkerd/linkerd2-proxy#798) * Simplify NewRouter initialization (linkerd/linkerd2-proxy#795) * Remove unused http::add_header module (linkerd/linkerd2-proxy#800) * Simplify concurrency-limit initialization (linkerd/linkerd2-proxy#799) * Remove the strip_header::Layer type (linkerd/linkerd2-proxy#801) * Simplify http-classify stack initialization (linkerd/linkerd2-proxy#804) * Simplify HTTP metrics initialization (linkerd/linkerd2-proxy#806) * Add checks to ensure support for opaque transport (linkerd/linkerd2-proxy#808) * Remove the override_authority::Layer type (linkerd/linkerd2-proxy#802) * Simplify tls::client module (linkerd/linkerd2-proxy#809) * Simplify header_from_target stack initialization (linkerd/linkerd2-proxy#803) * Cleanup HTTP boxing modules (linkerd/linkerd2-proxy#805) * Include scope names in failfast error messages (linkerd/linkerd2-proxy#791) * Simplify drain module implementation (linkerd/linkerd2-proxy#810) * Simplify BoxNewService initialization (linkerd/linkerd2-proxy#807) * admin: Add a /shutdown endpoint (linkerd/linkerd2-proxy#811) * stack: Remove the MakeReady helper (linkerd/linkerd2-proxy#813) * Remove the stack::Oneshot helper (linkerd/linkerd2-proxy#812) * http: Simplify http::boxed type references (linkerd/linkerd2-proxy#814) * Simplify stack type constraints (linkerd/linkerd2-proxy#815) * Rename transport types to ConnectTcp and BindTcp (linkerd/linkerd2-proxy#819) * Remove box from inbound connector (linkerd/linkerd2-proxy#816) * tap: Simplify tap initialization (linkerd/linkerd2-proxy#820) * Update Rust to 1.49.0 (linkerd/linkerd2-proxy#822) * Avoid boxing I/O types for optional TLS (linkerd/linkerd2-proxy#817) * Decouple TLS detection from TCP connections (linkerd/linkerd2-proxy#818) * stack: Rename NewOptional to NewUnwrapOr (linkerd/linkerd2-proxy#824) * inbound: Decouple inbound stack from TCP connections (linkerd/linkerd2-proxy#823) * Rename opaque-transport to transport-header (linkerd/linkerd2-proxy#825)
This was referenced Mar 29, 2021
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some applications, namely batch jobs, may prefer to manually signal that
the proxy should terminate instead of relying on a SIGTERM. There's no
good way for one container to send signals to another, though; so we
need an admin endpoint to support shutdown.
This change adds a
/shutdown
endpoint to the proxy's admin server thatcan be used to cause the proxy to initiate shutdown. Shutdown requests
must come on the loopback interface (i.e. from within the same
Kubernetes pod).