-
Notifications
You must be signed in to change notification settings - Fork 676
Open
Description
Search before asking
- I searched the issues and found no similar issues.
KubeRay Component
kubectl-plugin
Description
This is a follow up issue for #4291 (comment).
The kubectl-plugin has inconsistent namespace resolution patterns that all fail to respect the active kubeconfig context.
Current Behavior
Many Complete functions in get cluster, get workergroup, get nodes, delete, scale, and shell completion uses
if namespace == "" {
namespace = "default"
}Also in create cluster
namespace := "default"These hardcoded values ignore the user's current kubeconfig context namespace.
Expected Behavior
All commands should consistently use the Factory's namespace resolution to respect kubeconfig context.
namespace, _, err := f.ToRawKubeConfigLoader().Namespace()
if err != nil {
// error handling
}Some examples of using Factory's namespace resolution in the upstream kubectl includes
- https://github.com/kubernetes/kubernetes/blob/d719bc771fbf7090c74430b918f8d35871eaf64c/staging/src/k8s.io/kubectl/pkg/cmd/get/get.go#L197-L212
- https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/kubectl/pkg/util/completion/completion.go#L245
Affected Areas
Hardcode in completion functions:
- pkg/util/completion/completion.go (workerGroupCompletionFunc, nodeCompletionFunc)
Hardcode in Complete():
- pkg/cmd/get/get_cluster.go
- pkg/cmd/get/get_workergroup.go
- pkg/cmd/get/get_nodes.go
- pkg/cmd/get/get_token.go
- pkg/cmd/create/create_workergroup.go
- pkg/cmd/delete/delete.go
- pkg/cmd/scale/scale_cluster.go
- pkg/cmd/job/job_submit.go
- pkg/cmd/log/log.go
- pkg/cmd/session/session.go
resolveNamespace() in Run():
- pkg/cmd/create/create_cluster.go
There might be more, so would appreciate checking more closely during implementation.
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Metadata
Metadata
Assignees
Labels
No labels