Skip to content

Commit 449b39a

Browse files
committed
kubeadm: ensure image-pull-timeout flag is respected during upgrade phase
Signed-off-by: SataQiu <[email protected]>
1 parent f9532e4 commit 449b39a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cmd/kubeadm/app/cmd/upgrade/apply.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ func runApply(flags *applyFlags, userVersion string) error {
145145
}
146146
}
147147

148-
waiter := getWaiter(flags.dryRun, client)
148+
// Set the timeout as flags.imagePullTimeout to ensure that Prepuller truly respects 'image-pull-timeout' flag
149+
waiter := getWaiter(flags.dryRun, client, flags.imagePullTimeout)
149150

150151
// Use a prepuller implementation based on creating DaemonSets
151152
// and block until all DaemonSets are ready; then we know for sure that all control plane images are cached locally
@@ -159,6 +160,8 @@ func runApply(flags *applyFlags, userVersion string) error {
159160
return errors.Wrap(err, "[upgrade/prepull] Failed prepulled the images for the control plane components error")
160161
}
161162

163+
waiter = getWaiter(flags.dryRun, client, upgrade.UpgradeManifestTimeout)
164+
162165
// Now; perform the upgrade procedure
163166
klog.V(1).Infoln("[upgrade/apply] performing upgrade")
164167
if err := PerformControlPlaneUpgrade(flags, client, waiter, cfg); err != nil {

cmd/kubeadm/app/cmd/upgrade/common.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"io"
2424
"os"
2525
"strings"
26+
"time"
2627

2728
"github.com/pkg/errors"
2829

@@ -228,11 +229,11 @@ func getClient(file string, dryRun bool) (clientset.Interface, error) {
228229
}
229230

230231
// getWaiter gets the right waiter implementation
231-
func getWaiter(dryRun bool, client clientset.Interface) apiclient.Waiter {
232+
func getWaiter(dryRun bool, client clientset.Interface, timeout time.Duration) apiclient.Waiter {
232233
if dryRun {
233234
return dryrunutil.NewWaiter()
234235
}
235-
return apiclient.NewKubeWaiter(client, upgrade.UpgradeManifestTimeout, os.Stdout)
236+
return apiclient.NewKubeWaiter(client, timeout, os.Stdout)
236237
}
237238

238239
// InteractivelyConfirmUpgrade asks the user whether they _really_ want to upgrade.

0 commit comments

Comments
 (0)