etcd client add dial timeout

Kubernetes-commit: 814401fc902a7083bfd9933e245a2be62abfed60
This commit is contained in:
hzxuzhonghu 2018-03-21 14:45:13 +08:00 committed by Kubernetes Publisher
parent 9290515fd4
commit c5ff2cea2f
1 changed files with 5 additions and 2 deletions

View File

@ -29,11 +29,13 @@ import (
"k8s.io/apiserver/pkg/storage/value"
)
// The short keepalive timeout and interval have been chosen to aggressively
// detect a failed etcd server without introducing much overhead.
var (
// The short keepalive timeout and interval have been chosen to aggressively
// detect a failed etcd server without introducing much overhead.
keepaliveTime = 30 * time.Second
keepaliveTimeout = 10 * time.Second
// dialTimeout is the timeout for failing to establish a connection.
dialTimeout = 10 * time.Second
)
func newETCD3Storage(c storagebackend.Config) (storage.Interface, DestroyFunc, error) {
@ -52,6 +54,7 @@ func newETCD3Storage(c storagebackend.Config) (storage.Interface, DestroyFunc, e
tlsConfig = nil
}
cfg := clientv3.Config{
DialTimeout: dialTimeout,
DialKeepAliveTime: keepaliveTime,
DialKeepAliveTimeout: keepaliveTimeout,
Endpoints: c.ServerList,