Skip to content

Commit

Permalink
issue with default kubeconfig fixed
Browse files Browse the repository at this point in the history
clubanderson committed Apr 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent defee0c commit b7fdec6
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pkg/common/common.go
Original file line number Diff line number Diff line change
@@ -300,9 +300,4 @@ func (p ParamsStruct) GetObject(ocDynamicClientCoreOrWds dynamic.Interface, name
}
return objectJSON, nil
}

if err != nil {
return nil, err
}
return objectJSON, nil
}
2 changes: 2 additions & 0 deletions pkg/helpers/labeler-helpers.go
Original file line number Diff line number Diff line change
@@ -623,10 +623,12 @@ func SwitchContext(p c.ParamsStruct) (*kubernetes.Clientset, *rest.Config, *dyna
} else {
kubeConfigPath = filepath.Join(c.Flags.Kubeconfig)
}
// log.Println("labeler.go: kubeconfig path:", kubeConfigPath)
// if kubeconfig is still empty, use the default path
if kubeConfigPath == "" {
kubeConfigPath = filepath.Join(p.HomeDir, ".kube", "config")
}
// log.Println("labeler.go: kubeconfig path:", kubeConfigPath)

// load kubeconfig from file
apiConfig, err := clientcmd.LoadFromFile(kubeConfigPath)

0 comments on commit b7fdec6

Please sign in to comment.