Commit 19b27589 authored by Lorenz Brun's avatar Lorenz Brun

Fix etcd healthcheck for consensus failures

parent a2daf66a
...@@ -72,10 +72,12 @@ func newETCD3HealthCheck(c storagebackend.Config) (func() error, error) { ...@@ -72,10 +72,12 @@ func newETCD3HealthCheck(c storagebackend.Config) (func() error, error) {
client := clientValue.Load().(*clientv3.Client) client := clientValue.Load().(*clientv3.Client)
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel() defer cancel()
if _, err := client.Cluster.MemberList(ctx); err != nil { // See https://github.com/etcd-io/etcd/blob/master/etcdctl/ctlv3/command/ep_command.go#L118
return fmt.Errorf("error listing etcd members: %v", err) _, err := client.Get(ctx, "health")
if err == nil {
return nil
} }
return nil return fmt.Errorf("error getting data from etcd: %v", err)
}, nil }, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment