Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We'd better not depend on a kubeconfig file #3473

Open
lowang-bh opened this issue May 16, 2024 · 2 comments
Open

We'd better not depend on a kubeconfig file #3473

lowang-bh opened this issue May 16, 2024 · 2 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@lowang-bh
Copy link
Member

https://github.com/VasuDevrani/volcano/actions/runs/9105698087/job/25031701446?pr=1

E0516 02:53:19.986663   39759 utils.go:43] init kubeclient in 4pdvgpu failed: stat /home/runner/.kube/config: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x16d78bd]

goroutine 1 [running]:
volcano.sh/apis/pkg/client/clientset/versioned.NewForConfig(0x0?)
	/home/runner/go/pkg/mod/volcano.sh/apis@v1.9.0/pkg/client/clientset/versioned/clientset.go:92 +0x1d
volcano.sh/apis/pkg/client/clientset/versioned.NewForConfigOrDie(...)
	/home/runner/go/pkg/mod/volcano.sh/apis@v1.9.0/pkg/client/clientset/versioned/clientset.go:153
volcano.sh/volcano/test/e2e/jobp.TestMain(0x1c51e00?)
	/home/runner/work/volcano/volcano/test/e2e/jobp/main_test.go:35 +0x67
main.main()
	_testmain.go:83 +0x1e6
FAIL	volcano.sh/volcano/test/e2e/jobp	0.023s
E0516 02:53:19.986155   39760 utils.go:43] init kubeclient in 4pdvgpu failed: stat /home/runner/.kube/config: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference

code at

func init() {
var err error
kubeClient, err = NewClient()
if err != nil {
klog.Errorf("init kubeclient in hamivgpu failed: %s", err.Error())
} else {
klog.V(3).Infoln("init kubeclient success")
}
}
// NewClient connects to an API server
func NewClient() (kubernetes.Interface, error) {
kubeConfig := os.Getenv("KUBECONFIG")
if kubeConfig == "" {
kubeConfig = filepath.Join(os.Getenv("HOME"), ".kube", "config")
}
config, err := rest.InClusterConfig()
if err != nil {
config, err = clientcmd.BuildConfigFromFlags("", kubeConfig)
if err != nil {
return nil, err
}
}
client, err := kubernetes.NewForConfig(config)
kubeClient = client
return client, err
}

What would you like to be added:

The scheduler has its own service account. We'd better not to depend on a config file.

Why is this needed:

more compatible and portability

@lowang-bh lowang-bh added the kind/feature Categorizes issue or PR as related to a new feature. label May 16, 2024
@lowang-bh
Copy link
Member Author

@Monokaix @archlitchi

@Monokaix
Copy link
Member

When will this ut failed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants