Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func buildCommandArgs(agentConfig config.AgentConfig) []string {
args = append(args, strconv.Itoa(listenerDrainWaitTime))
}

if agentConfig.DisableHotRestart {
args = append(args, "--disable-hot-restart")
}

if len(agentConfig.CommandArgs) > 0 {
args = append(args, agentConfig.CommandArgs...)
}
Expand Down
7 changes: 6 additions & 1 deletion agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestBuildCommandArgs(t *testing.T) {

arguments := buildCommandArgs(agentConfig)

assert.Equal(t, len(arguments), 7)
assert.Equal(t, len(arguments), 8)
assert.ElementsMatch(t, []string{
agentConfig.CommandPath,
"-c",
Expand All @@ -58,6 +58,7 @@ func TestBuildCommandArgs(t *testing.T) {
agentConfig.EnvoyLogLevel,
"--drain-time-s",
strconv.Itoa(int(agentConfig.ListenerDrainWaitTime / time.Second)),
"--disable-hot-restart",
}, arguments)
}

Expand All @@ -68,6 +69,7 @@ func TestBuildCommandArgsNoEnvoyParameters(t *testing.T) {
agentConfig.EnvoyConfigPath = ""
agentConfig.EnvoyLogLevel = ""
agentConfig.ListenerDrainWaitTime = 0
agentConfig.DisableHotRestart = false

arguments := buildCommandArgs(agentConfig)

Expand Down Expand Up @@ -128,6 +130,7 @@ func TestKeepCommandAlive(t *testing.T) {
agentConfig.EnvoyConfigPath = ""
agentConfig.EnvoyLogLevel = ""
agentConfig.ListenerDrainWaitTime = 0
agentConfig.DisableHotRestart = false
agentConfig.CommandPath, _ = exec.LookPath("sleep")
agentConfig.CommandArgs = []string{sleepTime.String()}

Expand Down Expand Up @@ -167,6 +170,7 @@ func TestKeepCommandAliveWithRestart(t *testing.T) {
agentConfig.EnvoyConfigPath = ""
agentConfig.EnvoyLogLevel = ""
agentConfig.ListenerDrainWaitTime = 0
agentConfig.DisableHotRestart = false
agentConfig.EnvoyRestartCount = 2
agentConfig.CommandPath, _ = exec.LookPath("sleep")
agentConfig.CommandArgs = []string{"3"}
Expand Down Expand Up @@ -365,6 +369,7 @@ func TestLoggingToFileWithCommandExecution(t *testing.T) {
agentConfig.EnvoyConfigPath = ""
agentConfig.EnvoyLogLevel = ""
agentConfig.ListenerDrainWaitTime = 0
agentConfig.DisableHotRestart = false
agentConfig.CommandPath, _ = exec.LookPath("echo")
agentConfig.CommandArgs = []string{
"this", "is", "my", "test.",
Expand Down
3 changes: 3 additions & 0 deletions agent/config/agent_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const (
ENVOY_LISTENER_DRAINING_ENDPOINT_URL = "/drain_listeners"
ENVOY_CONCURRENCY_DEFAULT = -1 // we will not set concurrency [envoy --concurrency] by default.
ENVOY_CONCURRENCY_FOR_RELAY_DEFAULT = "1" // For relay we are defaulting it to 1
DISABLE_HOT_RESTART_DEFAULT = true
Comment thread
suniltheta marked this conversation as resolved.

// agent relay mode
ENABLE_RELAY_MODE_FOR_XDS_DEFAULT = false
Expand Down Expand Up @@ -157,6 +158,7 @@ type AgentConfig struct {
ListenerPortMapping string
MaxLogFileSizeMB float64
MaxLogCount int
DisableHotRestart bool

XdsEndpointUdsPath string

Expand Down Expand Up @@ -499,6 +501,7 @@ func (config *AgentConfig) SetDefaults() {
}

config.EnvoyConcurrency = getEnvValueAsInt("ENVOY_CONCURRENCY", ENVOY_CONCURRENCY_DEFAULT)
config.DisableHotRestart = getEnvValueAsBool("DISABLE_HOT_RESTART", DISABLE_HOT_RESTART_DEFAULT)

validateEnvoyLogLevel(&config.EnvoyLogLevel)

Expand Down