mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-26 08:10:20 +00:00
Fix kubeconfig default working correctly
Kuberentes e2e framework get kubeconfig information from KUBECONFIG environment variable. set the variable by default.
This commit is contained in:
parent
671e2d814a
commit
63589f3314
@ -4,6 +4,8 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
@ -24,6 +26,9 @@ func init() {
|
|||||||
|
|
||||||
flag.BoolVar(&rookRequired, "deploy-rook", true, "deploy rook on kubernetes")
|
flag.BoolVar(&rookRequired, "deploy-rook", true, "deploy rook on kubernetes")
|
||||||
flag.IntVar(&deployTimeout, "deploy-timeout", 10, "timeout to wait for created kubernetes resources")
|
flag.IntVar(&deployTimeout, "deploy-timeout", 10, "timeout to wait for created kubernetes resources")
|
||||||
|
|
||||||
|
setDefaultKubeconfig()
|
||||||
|
|
||||||
// Register framework flags, then handle flags
|
// Register framework flags, then handle flags
|
||||||
framework.HandleFlags()
|
framework.HandleFlags()
|
||||||
framework.AfterReadingAllFlags(&framework.TestContext)
|
framework.AfterReadingAllFlags(&framework.TestContext)
|
||||||
@ -32,6 +37,14 @@ func init() {
|
|||||||
fmt.Println("timeout for deploytimeout ", deployTimeout)
|
fmt.Println("timeout for deploytimeout ", deployTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setDefaultKubeconfig() {
|
||||||
|
_, exists := os.LookupEnv("KUBECONFIG")
|
||||||
|
if !exists {
|
||||||
|
defaultKubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
|
||||||
|
os.Setenv("KUBECONFIG", defaultKubeconfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// removeCephCSIResource is a temporary fix for CI to remove the ceph-csi resources deployed by rook
|
// removeCephCSIResource is a temporary fix for CI to remove the ceph-csi resources deployed by rook
|
||||||
func removeCephCSIResource() {
|
func removeCephCSIResource() {
|
||||||
// cleanup rbd and cephfs deamonset deployed by rook
|
// cleanup rbd and cephfs deamonset deployed by rook
|
||||||
|
Loading…
Reference in New Issue
Block a user