diff --git a/cmd/consul-dataplane/config.go b/cmd/consul-dataplane/config.go index 040a43fa..30630a8f 100644 --- a/cmd/consul-dataplane/config.go +++ b/cmd/consul-dataplane/config.go @@ -121,9 +121,10 @@ type EnvoyFlags struct { GracefulShutdownPath *string `json:"gracefulShutdownPath,omitempty"` GracefulPort *int `json:"gracefulPort,omitempty"` DumpEnvoyConfigOnExitEnabled *bool `json:"dumpEnvoyConfigOnExitEnabled,omitempty"` - - StartupGracePeriodSeconds *int `json:"startupGracePeriodSeconds,omitempty"` - GracefulStartupPath *string `json:"gracefulStartupPath,omitempty"` + //Time in seconds to wait for dataplane to be ready. + StartupGracePeriodSeconds *int `json:"startupGracePeriodSeconds,omitempty"` + //Endpoint for graceful startup function. + GracefulStartupPath *string `json:"gracefulStartupPath,omitempty"` } const ( diff --git a/pkg/consuldp/lifecycle.go b/pkg/consuldp/lifecycle.go index 713680b4..b01a49e1 100644 --- a/pkg/consuldp/lifecycle.go +++ b/pkg/consuldp/lifecycle.go @@ -220,6 +220,9 @@ func (m *lifecycleConfig) gracefulStartupHandler(rw http.ResponseWriter, _ *http // gracefulStartup blocks until the startup grace period has elapsed or we have confirmed that // Envoy proxy is ready. func (m *lifecycleConfig) gracefulStartup() { + if m.startupGracePeriodSeconds == 0 { + return + } timeout := time.Duration(m.startupGracePeriodSeconds) * time.Second m.logger.Info(fmt.Sprintf("blocking container startup until Envoy ready or grace period of %d seconds elapsed", m.startupGracePeriodSeconds)) ctx, cancel := context.WithTimeout(context.Background(), timeout)