You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ho...@apache.org on 2022/04/21 07:28:05 UTC
[skywalking-infra-e2e] 01/01: Update kind.go
This is an automated email from the ASF dual-hosted git repository.
hoshea pushed a commit to branch fgksgf-patch-1
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git
commit 19ba090a90b56893e21a1020ba3ec0665e1662cd
Author: Hoshea Jiang <fg...@gmail.com>
AuthorDate: Thu Apr 21 15:28:01 2022 +0800
Update kind.go
---
internal/components/cleanup/kind.go | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/internal/components/cleanup/kind.go b/internal/components/cleanup/kind.go
index f0f6888..cd9e9f3 100644
--- a/internal/components/cleanup/kind.go
+++ b/internal/components/cleanup/kind.go
@@ -21,6 +21,7 @@ package cleanup
import (
"os"
"strings"
+ "time"
"gopkg.in/yaml.v2"
kind "sigs.k8s.io/kind/cmd/kind/app"
@@ -31,6 +32,11 @@ import (
"github.com/apache/skywalking-infra-e2e/internal/logger"
)
+const (
+ maxRetry = 5
+ retryInterval = 2 // in seconds
+)
+
type KindClusterNameConfig struct {
Name string
}
@@ -74,7 +80,7 @@ func getKindClusterName(kindConfigFilePath string) (name string, err error) {
return nameConfig.Name, nil
}
-func cleanKindCluster(kindConfigFilePath string) error {
+func cleanKindCluster(kindConfigFilePath string) (err error) {
clusterName, err := getKindClusterName(kindConfigFilePath)
if err != nil {
return err
@@ -83,5 +89,14 @@ func cleanKindCluster(kindConfigFilePath string) error {
args := []string{"delete", "cluster", "--name", clusterName}
logger.Log.Debugf("cluster delete commands: %s %s", constant.KindCommand, strings.Join(args, " "))
- return kind.Run(kindcmd.NewLogger(), kindcmd.StandardIOStreams(), args)
+
+ // Sometimes kind delete cluster failed, so we retry it.
+ for i := 0; i < maxRetry; i++ {
+ if err = kind.Run(kindcmd.NewLogger(), kindcmd.StandardIOStreams(), args); err == nil {
+ return nil
+ }
+ time.Sleep(retryInterval * time.Second)
+ }
+
+ return
}