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

admin: Add a /shutdown endpoint #811

Merged
merged 3 commits into from
Dec 28, 2020
Merged

admin: Add a /shutdown endpoint #811

merged 3 commits into from
Dec 28, 2020

Conversation

olix0r
Copy link
Member

@olix0r olix0r commented Dec 27, 2020

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).

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 olix0r requested a review from a team December 27, 2020 22:17
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
Copy link
Contributor

@hawkw hawkw left a 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 olix0r merged commit 24bee8c into main Dec 28, 2020
@olix0r olix0r deleted the ver/admin-shutdown branch December 28, 2020 20:33
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)
@jimmykarily jimmykarily mentioned this pull request Feb 2, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants