From 9bef6ef55a61e19f5340e3a4537b6ee69cf824fb Mon Sep 17 00:00:00 2001 From: Ciprian Hacman Date: Mon, 8 Jan 2024 21:44:22 +0200 Subject: [PATCH] test: Improve cluster deletion defaults --- cmd/kops/delete_cluster.go | 3 ++- docs/cli/kops_delete_cluster.md | 4 ++-- tests/e2e/kubetest2-kops/deployer/down.go | 13 ++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/kops/delete_cluster.go b/cmd/kops/delete_cluster.go index 46e7a61bbf..62552b7110 100644 --- a/cmd/kops/delete_cluster.go +++ b/cmd/kops/delete_cluster.go @@ -51,8 +51,9 @@ type DeleteClusterOptions struct { } func (o *DeleteClusterOptions) InitDefaults() { - o.count = 42 + o.count = 0 o.interval = 10 * time.Second + o.wait = 10 * time.Minute } var ( diff --git a/docs/cli/kops_delete_cluster.md b/docs/cli/kops_delete_cluster.md index f7d8006c98..81e27d1c2e 100644 --- a/docs/cli/kops_delete_cluster.md +++ b/docs/cli/kops_delete_cluster.md @@ -24,13 +24,13 @@ kops delete cluster [CLUSTER] [flags] ### Options ``` - --count int Number of consecutive failures to make progress deleting the cluster resources (default 42) + --count int Number of consecutive failures to make progress deleting the cluster resources --external Delete an external cluster -h, --help help for cluster --interval duration Time in duration to wait between deletion attempts (default 10s) --region string External cluster's cloud region --unregister Don't delete cloud resources, just unregister the cluster - --wait duration Amount of time to wait for the cluster resources to de deleted + --wait duration Amount of time to wait for the cluster resources to de deleted (default 10m0s) -y, --yes Specify --yes to delete the cluster ``` diff --git a/tests/e2e/kubetest2-kops/deployer/down.go b/tests/e2e/kubetest2-kops/deployer/down.go index 09e69ecf38..389bf7938b 100644 --- a/tests/e2e/kubetest2-kops/deployer/down.go +++ b/tests/e2e/kubetest2-kops/deployer/down.go @@ -52,9 +52,16 @@ func (d *deployer) Down() error { d.KopsBinaryPath, "delete", "cluster", "--name", d.ClusterName, "--yes", - "--count=0", - "--interval=60s", - "--wait=60m", + } + version, err := kops.GetVersion(d.KopsBinaryPath) + if err != nil { + return err + } + if version > "1.29" { + args = append(args, + "--interval=60s", + "--wait=60m", + ) } klog.Info(strings.Join(args, " ")) cmd := exec.Command(args[0], args[1:]...)