diff --git a/.changelog/11144.txt b/.changelog/11144.txt new file mode 100644 index 000000000..b0a5f567f --- /dev/null +++ b/.changelog/11144.txt @@ -0,0 +1,3 @@ +```release-note:improvement +agent: Added `tls -> rpc_upgrade_mode` to be reloaded on SIGHUP +``` diff --git a/command/agent/agent.go b/command/agent/agent.go index ae373c86d..b070de555 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -1098,6 +1098,10 @@ func (a *Agent) ShouldReload(newConfig *Config) (agent, http bool) { agent = true } + if a.config.TLSConfig.RPCUpgradeMode != newConfig.TLSConfig.RPCUpgradeMode { + agent = true + } + return agent, http } diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index 0182ca264..f1a834cd4 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -1296,6 +1296,27 @@ func TestServer_ShouldReload_ShouldHandleMultipleChanges(t *testing.T) { } } +func TestServer_ShouldReload_ReturnTrueForRPCUpgradeModeChanges(t *testing.T) { + t.Parallel() + + sameAgentConfig := &Config{ + TLSConfig: &config.TLSConfig{ + RPCUpgradeMode: true, + }, + } + + agent := NewTestAgent(t, t.Name(), func(c *Config) { + c.TLSConfig = &config.TLSConfig{ + RPCUpgradeMode: false, + } + }) + defer agent.Shutdown() + + shouldReloadAgent, shouldReloadHTTP := agent.ShouldReload(sameAgentConfig) + require.True(t, shouldReloadAgent) + require.False(t, shouldReloadHTTP) +} + func TestAgent_ProxyRPC_Dev(t *testing.T) { t.Parallel() agent := NewTestAgent(t, t.Name(), nil)