Skip to content

Commit

Permalink
Merge pull request #2715 from NikitaSkrynnik/fix-4-clusters
Browse files Browse the repository at this point in the history
qfix: Fix problem with 4 kubeconfigs
  • Loading branch information
denis-tingaikin authored Apr 27, 2023
2 parents a7a007b + 6cd5bf6 commit eefdb79
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions extensions/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,25 @@ func initialize() {

jobsCh = make(chan func(), config.WorkerCount)

var kubeConfig = os.Getenv("KUBECONFIG")
var singleClusterKubeConfig = os.Getenv("KUBECONFIG")

if kubeConfig == "" {
kubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
if singleClusterKubeConfig == "" {
singleClusterKubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}

kubeConfigs = []string{kubeConfig}
kubeConfigs = []string{}

for i := 1; i <= config.MaxKubeConfigs; i++ {
kubeConfig = os.Getenv("KUBECONFIG" + fmt.Sprint(i))
kubeConfig := os.Getenv("KUBECONFIG" + fmt.Sprint(i))
if kubeConfig != "" {
kubeConfigs = append(kubeConfigs, kubeConfig)
}
}

if len(kubeConfigs) == 0 {
kubeConfigs = append(kubeConfigs, singleClusterKubeConfig)
}

for _, cfg := range kubeConfigs {
kubeconfig, err := clientcmd.BuildConfigFromFlags("", cfg)
if err != nil {
Expand Down

0 comments on commit eefdb79

Please sign in to comment.