You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/02/02 11:27:09 UTC
[skywalking-infra-e2e] branch main updated: [setup] create k8s
cluster config file in tempdir (#5)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git
The following commit(s) were added to refs/heads/main by this push:
new 9f080da [setup] create k8s cluster config file in tempdir (#5)
9f080da is described below
commit 9f080da09a26edbdba2d0380bcc2446d0b59cde2
Author: Humbertzhang <50...@qq.com>
AuthorDate: Tue Feb 2 19:26:53 2021 +0800
[setup] create k8s cluster config file in tempdir (#5)
---
internal/components/cleanup/kind.go | 6 +++---
internal/components/setup/kind.go | 2 +-
internal/constant/kind.go | 13 +++++++++----
internal/util/{which.go => utils.go} | 0
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/internal/components/cleanup/kind.go b/internal/components/cleanup/kind.go
index 2f7c33a..2fc4de2 100644
--- a/internal/components/cleanup/kind.go
+++ b/internal/components/cleanup/kind.go
@@ -48,9 +48,9 @@ func KindCleanUp(e2eConfig *config.E2EConfig) error {
}
logger.Log.Info("delete kind cluster succeeded")
- k8sConfigFile := constant.K8sClusterConfigFile
- logger.Log.Infof("deleting k8s cluster config file:%s", k8sConfigFile)
- err := os.Remove(k8sConfigFile)
+ kubeConfigPath := constant.K8sClusterConfigFilePath
+ logger.Log.Infof("deleting k8s cluster config file:%s", kubeConfigPath)
+ err := os.Remove(kubeConfigPath)
if err != nil {
logger.Log.Errorf("delete k8s cluster config file failed")
return err
diff --git a/internal/components/setup/kind.go b/internal/components/setup/kind.go
index 96e5edd..9f7b156 100644
--- a/internal/components/setup/kind.go
+++ b/internal/components/setup/kind.go
@@ -94,7 +94,7 @@ func KindSetup(e2eConfig *config.E2EConfig) error {
func createKindCluster(kindConfigPath string) error {
// the config file name of the k8s cluster that kind create
- kubeConfigPath = constant.K8sClusterConfigFile
+ kubeConfigPath = constant.K8sClusterConfigFilePath
args := []string{"create", "cluster", "--config", kindConfigPath, "--kubeconfig", kubeConfigPath}
logger.Log.Info("creating kind cluster...")
diff --git a/internal/constant/kind.go b/internal/constant/kind.go
index 7b8586d..b6bb7cb 100644
--- a/internal/constant/kind.go
+++ b/internal/constant/kind.go
@@ -18,19 +18,24 @@
package constant
-import "time"
+import (
+ "os"
+ "path"
+ "time"
+)
const (
Kind = "kind"
KindCommand = "kind"
KindClusterDefaultName = "kind"
E2EDefaultFile = "e2e.yaml"
- K8sClusterConfigFile = "e2e-k8s.config"
+ K8sClusterConfigFileName = "e2e-k8s.config"
DefaultWaitTimeout = 600 * time.Second
SingleDefaultWaitTimeout = 30 * 60 * time.Second
)
var (
- True = true
- False = false
+ True = true
+ False = false
+ K8sClusterConfigFilePath = path.Join(os.TempDir(), K8sClusterConfigFileName)
)
diff --git a/internal/util/which.go b/internal/util/utils.go
similarity index 100%
rename from internal/util/which.go
rename to internal/util/utils.go