Skip to content

Commit

Permalink
cmd: plumb Envoy graceful shutdown args into Config.Envoy struct
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemorris committed Jun 6, 2023
1 parent ecfe23f commit 04e73f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
19 changes: 10 additions & 9 deletions cmd/consul-dataplane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ func init() {
// Default is false because it will generally be configured appropriately by Helm
// configuration or pod annotation.
BoolVar(&shutdownDrainListeners, "shutdown-drain-listeners", false, "DP_SHUTDOWN_DRAIN_LISTENERS", "Wait for proxy listeners to drain before terminating the proxy container.")
// TODO: Should the grace period be implemented as a minimum or maximum? If all
// connections have drained from the proxy before the end of the grace period,
// should it terminate earlier?
// Default is 0 because it will generally be configured appropriately by Helm
// configuration or pod annotation.
IntVar(&shutdownGracePeriod, "shutdown-grace-period", 0, "DP_SHUTDOWN_GRACE_PERIOD", "Amount of time to wait after receiving a SIGTERM signal before terminating the proxy.")
Expand Down Expand Up @@ -233,12 +230,16 @@ func main() {
},
},
Envoy: &consuldp.EnvoyConfig{
AdminBindAddress: adminBindAddr,
AdminBindPort: adminBindPort,
ReadyBindAddress: readyBindAddr,
ReadyBindPort: readyBindPort,
EnvoyConcurrency: envoyConcurrency,
ExtraArgs: flag.Args(),
AdminBindAddress: adminBindAddr,
AdminBindPort: adminBindPort,
ReadyBindAddress: readyBindAddr,
ReadyBindPort: readyBindPort,
EnvoyConcurrency: envoyConcurrency,
ShutdownDrainListeners: shutdownDrainListeners,
ShutdownGracePeriod: shutdownGracePeriod,
GracefulShutdownPath: gracefulShutdownPath,
GracefulPort: gracefulPort,
ExtraArgs: flag.Args(),
},
XDSServer: &consuldp.XDSServer{
BindAddress: xdsBindAddr,
Expand Down
8 changes: 8 additions & 0 deletions pkg/consuldp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ type EnvoyConfig struct {
ReadyBindPort int
// EnvoyConcurrency is the envoy concurrency https://www.envoyproxy.io/docs/envoy/latest/operations/cli#cmdoption-concurrency
EnvoyConcurrency int
// ShutdownDrainListeners configures whether to wait for all proxy listeners to drain before terminating the proxy container.
ShutdownDrainListeners bool
// ShutdownGracePeriod is the amount of time to wait after receiving a SIGTERM before terminating the proxy container.
ShutdownGracePeriod int
// GracefulShutdownPath is the path on which the HTTP endpoint to initiate a graceful shutdown of Envoy is served
GracefulShutdownPath string
// GracefulPort is the port on which the HTTP server for graceful shutdown endpoints will be available.
GracefulPort int
// ExtraArgs are the extra arguments passed to envoy at startup of the proxy
ExtraArgs []string
}
Expand Down

0 comments on commit 04e73f2

Please sign in to comment.