mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-22 21:10:22 +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"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@ -24,6 +26,9 @@ func init() {
|
||||
|
||||
flag.BoolVar(&rookRequired, "deploy-rook", true, "deploy rook on kubernetes")
|
||||
flag.IntVar(&deployTimeout, "deploy-timeout", 10, "timeout to wait for created kubernetes resources")
|
||||
|
||||
setDefaultKubeconfig()
|
||||
|
||||
// Register framework flags, then handle flags
|
||||
framework.HandleFlags()
|
||||
framework.AfterReadingAllFlags(&framework.TestContext)
|
||||
@ -32,6 +37,14 @@ func init() {
|
||||
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
|
||||
func removeCephCSIResource() {
|
||||
// cleanup rbd and cephfs deamonset deployed by rook
|
||||
|
Loading…
Reference in New Issue
Block a user