Skip to content

Commit

Permalink
e2e: respect KUBECONFIG
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Feb 29, 2024
1 parent 510e143 commit 5e55da2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions e2e/internal/kubeclient/kubeclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ func NewFromConfigFile(configPath string, log *slog.Logger) (*Kubeclient, error)
func NewForTest(t *testing.T) *Kubeclient {
t.Helper()
log := slog.New(slog.NewTextHandler(os.Stderr, nil))
// TODO(burgerdev): consider reading KUBECONFIG env var
c, err := NewFromConfigFile(clientcmd.RecommendedHomeFile, log)
configFile := os.Getenv("KUBECONFIG")
if configFile == "" {
configFile = clientcmd.RecommendedHomeFile
}
c, err := NewFromConfigFile(configFile, log)
if err != nil {
t.Fatalf("Could not create Kubeclient: %v", err)
}
Expand Down

0 comments on commit 5e55da2

Please sign in to comment.