mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #61459 from hzxuzhonghu/etcdv3-dial-timeout
Automatic merge from submit-queue (batch tested with PRs 62324, 61459, 62475, 62476, 61914). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. etcdv3 client: add dial timeout dial timeout is necessary for a reliable system, this pr add it for establishing an etcd connection. **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -29,11 +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 (
 | 
					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
 | 
						keepaliveTime    = 30 * time.Second
 | 
				
			||||||
	keepaliveTimeout = 10 * 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) {
 | 
					func newETCD3Storage(c storagebackend.Config) (storage.Interface, DestroyFunc, error) {
 | 
				
			||||||
@@ -52,6 +54,7 @@ func newETCD3Storage(c storagebackend.Config) (storage.Interface, DestroyFunc, e
 | 
				
			|||||||
		tlsConfig = nil
 | 
							tlsConfig = nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	cfg := clientv3.Config{
 | 
						cfg := clientv3.Config{
 | 
				
			||||||
 | 
							DialTimeout:          dialTimeout,
 | 
				
			||||||
		DialKeepAliveTime:    keepaliveTime,
 | 
							DialKeepAliveTime:    keepaliveTime,
 | 
				
			||||||
		DialKeepAliveTimeout: keepaliveTimeout,
 | 
							DialKeepAliveTimeout: keepaliveTimeout,
 | 
				
			||||||
		Endpoints:            c.ServerList,
 | 
							Endpoints:            c.ServerList,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user