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 · 5 comments
Open

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

lowang-bh opened this issue May 16, 2024 · 5 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. 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/[email protected]/pkg/client/clientset/versioned/clientset.go:92 +0x1d
volcano.sh/apis/pkg/client/clientset/versioned.NewForConfigOrDie(...)
	/home/runner/go/pkg/mod/volcano.sh/[email protected]/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?

@Monokaix
Copy link
Member

Monokaix commented Jan 2, 2025

/good-first-issue

@volcano-sh-bot
Copy link
Contributor

@Monokaix:
This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@volcano-sh-bot volcano-sh-bot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jan 2, 2025
@archlitchi
Copy link
Contributor

Fixed in this PR: #3953

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants