mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
fix case when HC timeout is 0
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
This commit is contained in:
parent
2e430ba622
commit
6af838c3d1
@ -92,7 +92,11 @@ func newETCD3HealthCheck(c storagebackend.Config) (func() error, error) {
|
|||||||
return fmt.Errorf(errMsg)
|
return fmt.Errorf(errMsg)
|
||||||
}
|
}
|
||||||
client := clientValue.Load().(*clientv3.Client)
|
client := clientValue.Load().(*clientv3.Client)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), c.HealthcheckTimeout)
|
healthcheckTimeout := storagebackend.DefaultHealthcheckTimeout
|
||||||
|
if c.HealthcheckTimeout != time.Duration(0) {
|
||||||
|
healthcheckTimeout = c.HealthcheckTimeout
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), healthcheckTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
// See https://github.com/etcd-io/etcd/blob/c57f8b3af865d1b531b979889c602ba14377420e/etcdctl/ctlv3/command/ep_command.go#L118
|
// See https://github.com/etcd-io/etcd/blob/c57f8b3af865d1b531b979889c602ba14377420e/etcdctl/ctlv3/command/ep_command.go#L118
|
||||||
_, err := client.Get(ctx, path.Join("/", c.Prefix, "health"))
|
_, err := client.Get(ctx, path.Join("/", c.Prefix, "health"))
|
||||||
|
Loading…
Reference in New Issue
Block a user