Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
allow KUBECONFIG to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
complex64 committed Apr 23, 2019
1 parent 0c48bca commit d9cd178
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/pkg/rotator/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"os"
"strings"
"time"

Expand All @@ -16,13 +17,22 @@ import (
"github.com/tenjin/rotate-eks-asg/internal/pkg/cmd"
)

const (
DefaultKubeConfigPath = "/tmp/.kube/config"
)

var (
DefaultNodeAwaitJoinTimeout = 30 * time.Second
DefaultNodeAwaitReadinessTimeout = 10 * time.Second
)

func NewKubernetesClient() (*kubernetes.Clientset, error) {
config, err := clientcmd.BuildConfigFromFlags("", "/tmp/.kube/config") // TODO
kcfg := os.Getenv("KUBECONFIG")
if kcfg == "" {
kcfg = DefaultKubeConfigPath
}

config, err := clientcmd.BuildConfigFromFlags("", kcfg)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d9cd178

Please sign in to comment.