From 1d4266432c0e2617fdcd100164bd94329bc07d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A5=9A=E5=B2=B3?= Date: Thu, 2 Jun 2022 11:52:13 +0800 Subject: [PATCH] hold the force uninstalling process untill the last addon been deleted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 楚岳 fix lint Signed-off-by: 楚岳 fix comments Signed-off-by: 楚岳 fix comments Signed-off-by: 楚岳 --- references/cli/uninstall.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/references/cli/uninstall.go b/references/cli/uninstall.go index 6d9859d66..e45137363 100644 --- a/references/cli/uninstall.go +++ b/references/cli/uninstall.go @@ -209,6 +209,21 @@ func forceDisableAddon(ctx context.Context, kubeClient client.Client, config *re if err := pkgaddon.DisableAddon(ctx, kubeClient, "fluxcd", config, true); err != nil { return err } + timeConsumed = time.Now() + for { + if time.Now().After(timeConsumed.Add(2 * time.Minute)) { + return errors.New("timeout disable fluxcd addon, please disable the addon manually") + } + addons, err := checkInstallAddon(kubeClient) + if err != nil { + return err + } + if len(addons) == 0 { + break + } + fmt.Println("Waiting delete the fluxcd addon......") + time.Sleep(5 * time.Second) + } } return nil }