Skip to content

Commit dce6678

Browse files
authored
Merge pull request kubernetes#7237 from tstromberg/addon-retry
Retry addon application
2 parents 5a316b3 + ea9aa72 commit dce6678

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,6 @@ github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht
421421
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
422422
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
423423
github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8=
424-
github.com/johanneswuerbach/nfsexports v0.0.0-20181204082207-1aa528dcb345 h1:XP1VL9iOZu4yz/rq8zj+yvB23XEY5erXRzp8JYmkWu0=
425-
github.com/johanneswuerbach/nfsexports v0.0.0-20181204082207-1aa528dcb345/go.mod h1:+c1/kUpg2zlkoWqTOvzDs36Wpbm3Gd1nlmtXAEB0WGU=
426424
github.com/johanneswuerbach/nfsexports v0.0.0-20200318065542-c48c3734757f h1:tL0xH80QVHQOde6Qqdohv6PewABH8l8N9pywZtuojJ0=
427425
github.com/johanneswuerbach/nfsexports v0.0.0-20200318065542-c48c3734757f/go.mod h1:+c1/kUpg2zlkoWqTOvzDs36Wpbm3Gd1nlmtXAEB0WGU=
428426
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=

pkg/addons/addons.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"k8s.io/minikube/pkg/minikube/machine"
3535
"k8s.io/minikube/pkg/minikube/out"
3636
"k8s.io/minikube/pkg/minikube/storageclass"
37+
"k8s.io/minikube/pkg/util/retry"
3738
)
3839

3940
// defaultStorageClassProvisioner is the name of the default storage class provisioner
@@ -211,13 +212,17 @@ func enableOrDisableAddonInternal(cc *config.ClusterConfig, addon *assets.Addon,
211212
}
212213

213214
command := kubectlCommand(cc, deployFiles, enable)
214-
glog.Infof("Running: %v", command)
215-
rr, err := cmd.RunCmd(command)
216-
if err != nil {
217-
return errors.Wrapf(err, "addon apply")
215+
216+
// Retry, because sometimes we race against an apiserver restart
217+
apply := func() error {
218+
_, err := cmd.RunCmd(command)
219+
if err != nil {
220+
glog.Warningf("apply failed, will retry: %v", err)
221+
}
222+
return err
218223
}
219-
glog.Infof("output:\n%s", rr.Output())
220-
return nil
224+
225+
return retry.Expo(apply, 1*time.Second, time.Second*30)
221226
}
222227

223228
// enableOrDisableStorageClasses enables or disables storage classes

0 commit comments

Comments
 (0)