From a5c23789c02380e575d204b333b28b4b02787859 Mon Sep 17 00:00:00 2001 From: Ethan Mosbaugh Date: Tue, 15 Oct 2024 14:29:26 -0500 Subject: [PATCH] fix: install flake waiting for k0s (#1327) --- cmd/embedded-cluster/install.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/embedded-cluster/install.go b/cmd/embedded-cluster/install.go index aa7058391..df27173b0 100644 --- a/cmd/embedded-cluster/install.go +++ b/cmd/embedded-cluster/install.go @@ -514,10 +514,16 @@ func waitForK0s() error { if !success { return fmt.Errorf("timeout waiting for %s", defaults.BinaryName()) } - if _, err := helpers.RunCommand(defaults.K0sBinaryPath(), "status"); err != nil { - return fmt.Errorf("unable to get status: %w", err) + + for i := 1; ; i++ { + _, err := helpers.RunCommand(defaults.K0sBinaryPath(), "status") + if err == nil { + return nil + } else if i == 5 { + return fmt.Errorf("unable to get status: %w", err) + } + time.Sleep(2 * time.Second) } - return nil } // installAndWaitForK0s installs the k0s binary and waits for it to be ready