etcd client: add keepalive
Kubernetes-commit: 31ff8c6b9a08d1168502e423bdd3fdbe4f2f729b
This commit is contained in:
parent
74bf920708
commit
e8ca085614
|
|
@ -17,6 +17,8 @@ limitations under the License.
|
||||||
package factory
|
package factory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
"github.com/coreos/etcd/pkg/transport"
|
"github.com/coreos/etcd/pkg/transport"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
@ -27,6 +29,13 @@ import (
|
||||||
"k8s.io/apiserver/pkg/storage/value"
|
"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 (
|
||||||
|
keepaliveTime = 30 * time.Second
|
||||||
|
keepaliveTimeout = 10 * time.Second
|
||||||
|
)
|
||||||
|
|
||||||
func newETCD3Storage(c storagebackend.Config) (storage.Interface, DestroyFunc, error) {
|
func newETCD3Storage(c storagebackend.Config) (storage.Interface, DestroyFunc, error) {
|
||||||
tlsInfo := transport.TLSInfo{
|
tlsInfo := transport.TLSInfo{
|
||||||
CertFile: c.CertFile,
|
CertFile: c.CertFile,
|
||||||
|
|
@ -43,6 +52,8 @@ func newETCD3Storage(c storagebackend.Config) (storage.Interface, DestroyFunc, e
|
||||||
tlsConfig = nil
|
tlsConfig = nil
|
||||||
}
|
}
|
||||||
cfg := clientv3.Config{
|
cfg := clientv3.Config{
|
||||||
|
DialKeepAliveTime: keepaliveTime,
|
||||||
|
DialKeepAliveTimeout: keepaliveTimeout,
|
||||||
Endpoints: c.ServerList,
|
Endpoints: c.ServerList,
|
||||||
TLS: tlsConfig,
|
TLS: tlsConfig,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue