Add ReusePort/ReuseAddr flags to etcd config

Addresses flakes in etcd CI due to the port still being in TIME_WAIT after the server is shut down between tests

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson
2025-04-08 20:32:34 +00:00
committed by Brad Davidson
parent 15ed009031
commit 9deef77eef
2 changed files with 7 additions and 1 deletions

View File

@@ -55,6 +55,8 @@ type ETCDConfig struct {
ServerTrust ServerTrust `json:"client-transport-security"`
PeerTrust PeerTrust `json:"peer-transport-security"`
ForceNewCluster bool `json:"force-new-cluster,omitempty"`
ReuseAddress bool `json:"reuse-address,omitempty"`
ReusePort bool `json:"reuse-port,omitempty"`
HeartbeatInterval int `json:"heartbeat-interval"`
ElectionTimeout int `json:"election-timeout"`
Logger string `json:"logger"`

View File

@@ -1035,6 +1035,8 @@ func (e *ETCD) cluster(ctx context.Context, reset bool, options executor.Initial
HeartbeatInterval: 500,
Logger: "zap",
LogOutputs: []string{"stderr"},
ReuseAddress: true,
ReusePort: true,
ListenClientHTTPURLs: e.listenClientHTTPURLs(),
ExperimentalInitialCorruptCheck: true,
@@ -1098,11 +1100,13 @@ func (e *ETCD) StartEmbeddedTemporary(ctx context.Context) error {
ListenClientHTTPURLs: clientHTTPURL,
ListenPeerURLs: peerURL,
Logger: "zap",
LogOutputs: []string{"stderr"},
ReuseAddress: true,
ReusePort: true,
HeartbeatInterval: 500,
ElectionTimeout: 5000,
SnapshotCount: 10000,
Name: e.name,
LogOutputs: []string{"stderr"},
ExperimentalInitialCorruptCheck: true,
ExperimentalWatchProgressNotifyInterval: e.config.Datastore.NotifyInterval,