mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Fix etcd healthcheck for consensus failures
This commit is contained in:
parent
a2daf66a0d
commit
19b2758919
@ -72,10 +72,12 @@ func newETCD3HealthCheck(c storagebackend.Config) (func() error, error) {
|
||||
client := clientValue.Load().(*clientv3.Client)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
if _, err := client.Cluster.MemberList(ctx); err != nil {
|
||||
return fmt.Errorf("error listing etcd members: %v", err)
|
||||
// See https://github.com/etcd-io/etcd/blob/master/etcdctl/ctlv3/command/ep_command.go#L118
|
||||
_, err := client.Get(ctx, "health")
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
return fmt.Errorf("error getting data from etcd: %v", err)
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user