Skip to content

Commit b04e1b8

Browse files
committed
kubeadm: use the v1beta4 EtcdAPICall timeout for etcd calls
v1beta4 added the Timeouts struct and a EtcdAPICall timeout field, but it was never used in the etcd client calls. This is a bug, so it should be fixed, we also reduced the timeout from 200 seconds exponentional backoff to 2 minute linear default timeout.
1 parent fbdba41 commit b04e1b8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cmd/kubeadm/app/util/etcd/etcd.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func (c *Client) Sync() error {
249249
// Syncs the list of endpoints
250250
var cli etcdClient
251251
var lastError error
252-
err := wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, constants.EtcdAPICallTimeout,
252+
err := wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration,
253253
true, func(_ context.Context) (bool, error) {
254254
var err error
255255
cli, err = c.newEtcdClient(c.Endpoints)
@@ -289,7 +289,7 @@ func (c *Client) listMembers(timeout time.Duration) (*clientv3.MemberListRespons
289289
var lastError error
290290
var resp *clientv3.MemberListResponse
291291
if timeout == 0 {
292-
timeout = constants.EtcdAPICallTimeout
292+
timeout = kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration
293293
}
294294
err := wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, timeout,
295295
true, func(_ context.Context) (bool, error) {
@@ -358,7 +358,7 @@ func (c *Client) RemoveMember(id uint64) ([]Member, error) {
358358
lastError error
359359
respMembers []*etcdserverpb.Member
360360
)
361-
err = wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, constants.EtcdAPICallTimeout,
361+
err = wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration,
362362
true, func(_ context.Context) (bool, error) {
363363
ctx, cancel := context.WithTimeout(context.Background(), etcdTimeout)
364364
defer cancel()
@@ -447,7 +447,7 @@ func (c *Client) addMember(name string, peerAddrs string, isLearner bool) ([]Mem
447447
respMembers []*etcdserverpb.Member
448448
resp *clientv3.MemberAddResponse
449449
)
450-
err = wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, constants.EtcdAPICallTimeout,
450+
err = wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration,
451451
true, func(_ context.Context) (bool, error) {
452452
ctx, cancel := context.WithTimeout(context.Background(), etcdTimeout)
453453
defer cancel()
@@ -571,7 +571,7 @@ func (c *Client) MemberPromote(learnerID uint64) error {
571571
var (
572572
lastError error
573573
)
574-
err = wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, constants.EtcdAPICallTimeout,
574+
err = wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration,
575575
true, func(_ context.Context) (bool, error) {
576576
ctx, cancel := context.WithTimeout(context.Background(), etcdTimeout)
577577
defer cancel()
@@ -604,7 +604,7 @@ func (c *Client) getClusterStatus() (map[string]*clientv3.StatusResponse, error)
604604
// Gets the member status
605605
var lastError error
606606
var resp *clientv3.StatusResponse
607-
err := wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, constants.EtcdAPICallTimeout,
607+
err := wait.PollUntilContextTimeout(context.Background(), constants.EtcdAPICallRetryInterval, kubeadmapi.GetActiveTimeouts().EtcdAPICall.Duration,
608608
true, func(_ context.Context) (bool, error) {
609609
cli, err := c.newEtcdClient(c.Endpoints)
610610
if err != nil {

0 commit comments

Comments
 (0)