Fix etcd socket option config

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/12142/head
Brad Davidson 2025-04-11 17:51:10 +00:00 committed by Brad Davidson
parent aa14a039d3
commit ece7520bcc
2 changed files with 29 additions and 23 deletions

View File

@ -42,25 +42,29 @@ type Executor interface {
CRIReadyChan() <-chan struct{}
}
type ETCDSocketOpts struct {
ReuseAddress bool `json:"reuse-address,omitempty"`
ReusePort bool `json:"reuse-port,omitempty"`
}
type ETCDConfig struct {
InitialOptions `json:",inline"`
Name string `json:"name,omitempty"`
ListenClientURLs string `json:"listen-client-urls,omitempty"`
ListenClientHTTPURLs string `json:"listen-client-http-urls,omitempty"`
ListenMetricsURLs string `json:"listen-metrics-urls,omitempty"`
ListenPeerURLs string `json:"listen-peer-urls,omitempty"`
AdvertiseClientURLs string `json:"advertise-client-urls,omitempty"`
DataDir string `json:"data-dir,omitempty"`
SnapshotCount int `json:"snapshot-count,omitempty"`
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"`
LogOutputs []string `json:"log-outputs"`
Name string `json:"name,omitempty"`
ListenClientURLs string `json:"listen-client-urls,omitempty"`
ListenClientHTTPURLs string `json:"listen-client-http-urls,omitempty"`
ListenMetricsURLs string `json:"listen-metrics-urls,omitempty"`
ListenPeerURLs string `json:"listen-peer-urls,omitempty"`
AdvertiseClientURLs string `json:"advertise-client-urls,omitempty"`
DataDir string `json:"data-dir,omitempty"`
SnapshotCount int `json:"snapshot-count,omitempty"`
ServerTrust ServerTrust `json:"client-transport-security"`
PeerTrust PeerTrust `json:"peer-transport-security"`
ForceNewCluster bool `json:"force-new-cluster,omitempty"`
HeartbeatInterval int `json:"heartbeat-interval"`
ElectionTimeout int `json:"election-timeout"`
Logger string `json:"logger"`
LogOutputs []string `json:"log-outputs"`
SocketOpts ETCDSocketOpts `json:"socket-options"`
ExperimentalInitialCorruptCheck bool `json:"experimental-initial-corrupt-check"`
ExperimentalWatchProgressNotifyInterval time.Duration `json:"experimental-watch-progress-notify-interval"`

View File

@ -1035,10 +1035,11 @@ 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(),
SocketOpts: executor.ETCDSocketOpts{
ReuseAddress: true,
ReusePort: true,
},
ExperimentalInitialCorruptCheck: true,
ExperimentalWatchProgressNotifyInterval: e.config.Datastore.NotifyInterval,
}, e.config.ExtraEtcdArgs, e.Test)
@ -1101,13 +1102,14 @@ func (e *ETCD) StartEmbeddedTemporary(ctx context.Context) error {
ListenPeerURLs: peerURL,
Logger: "zap",
LogOutputs: []string{"stderr"},
ReuseAddress: true,
ReusePort: true,
HeartbeatInterval: 500,
ElectionTimeout: 5000,
SnapshotCount: 10000,
Name: e.name,
SocketOpts: executor.ETCDSocketOpts{
ReuseAddress: true,
ReusePort: true,
},
ExperimentalInitialCorruptCheck: true,
ExperimentalWatchProgressNotifyInterval: e.config.Datastore.NotifyInterval,
}, append(e.config.ExtraEtcdArgs, "--max-snapshots=0", "--max-wals=0"), e.Test)