Backport of proxy-lifecycle: add HTTP Server with endpoints for proxy lifecycle shutdown into release/1.0.x #180
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.
Backport
This PR is auto-generated from #115 to be assessed for backporting due to the inclusion of the label backport/1.0.
WARNING automatic cherry-pick of commits failed. Commits will require human attention.
The below text is copied from the body of the original PR.
Refs hashicorp/consul-k8s#536, hashicorp/consul-k8s#650
Adds a proxy lifecycle management server and starts it from the consul-dataplane main process. This server exposes an HTTP endpoint (configurable, defaulting to
/graceful_shutdown
on port 20300) to optionally start draining inbound (external) connections to the managed Envoy proxy, while allowing outbound requests from the application for which this proxy is acting as a sidecar to continue, up to a configurable grace period timeout, to facilitate application shutdown.Refactors the
envoy
package proxy manager to introduce new states (stateDraining
andstateExited
) and new methods (Drain()
,Quit()
and renamingStop()
toKill()
to avoid confusion and better describe the actual implementation) and implement an interface to allow a mock implementation for testing the lifecycle management server in isolation.Notes for reviewers
/graceful_shutdown
endpoint explicitly (which will be necessary for handling job termination from apreStop
hook) in the future.envoy
package does not have proper test coverage yet - I'm hoping to add this as a followup by replacing the currentfake-envoy
implementation with a Go-based version to include an HTTP server mocking the/drain_listeners
and/quitquitquit
Envoy admin API endpoints.envoyExtraArgs
refactor will likely conflict with fix: log level present in extra args using envoy-extra-args annotation : NET-2190 #133 and need to be resolvedLinks
Overview of commits