From 0345e29c9722d30e510a1c9d39dac0f90ef33e97 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Wed, 11 Oct 2023 08:03:14 -0700 Subject: [PATCH] QEMU: Fix addons failing to enable --- pkg/drivers/qemu/qemu.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/drivers/qemu/qemu.go b/pkg/drivers/qemu/qemu.go index c3772bab9504..5d1569a4aa6a 100644 --- a/pkg/drivers/qemu/qemu.go +++ b/pkg/drivers/qemu/qemu.go @@ -48,6 +48,7 @@ import ( "k8s.io/minikube/pkg/minikube/reason" "k8s.io/minikube/pkg/minikube/style" "k8s.io/minikube/pkg/network" + "k8s.io/minikube/pkg/util/retry" ) const ( @@ -196,8 +197,14 @@ func (d *Driver) GetState() (state.State, error) { return state.Stopped, nil } } - ret, err := d.RunQMPCommand("query-status") - if err != nil { + var ret map[string]interface{} + queryStatus := func() (err error) { + ret, err = d.RunQMPCommand("query-status") + return err + } + // on arm64 Macs the monitor may refuse connection for a second after creating the cluster, resulting in addons + // not being enabled, a simple retry resolves this, see: https://github.com/kubernetes/minikube/issues/17396 + if err := retry.Expo(queryStatus, 1*time.Second, 10*time.Second); err != nil { return state.Error, err }