-
Notifications
You must be signed in to change notification settings - Fork 549
[kubeclt-plugin] fix get cluster all namespace #3809
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
[kubeclt-plugin] fix get cluster all namespace #3809
Conversation
Signed-off-by: fscnick <[email protected]>
} | ||
if tc.namespace != nil { | ||
fakeClusterGetOptions.namespace = *tc.namespace | ||
} | ||
|
||
kubeClientSet := kubefake.NewClientset() | ||
rayClient := rayClientFake.NewSimpleClientset(tc.rayClusters...) | ||
rayClient := rayClientFake.NewSimpleClientset(tc.injectedRayClusters...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code takes tc.rayClusters
to inject to fake client and tc.rayClusters
also be a condition to verify the result. That seems put what you expected and verify it. It might lack the capability of testing exclusion. Thus, add tc.injectedRayClusters
to provide this possibility.
@@ -42,7 +42,7 @@ func TestRayClusterGetComplete(t *testing.T) { | |||
name: "neither namespace nor args set", | |||
namespace: "", | |||
args: []string{}, | |||
expectedAllNamespaces: true, | |||
expectedAllNamespaces: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original test case looks like the all namespace is expected if no namespace provide. However, it is not consistent with get nodes
and get workergroup
@MortalHappiness PTAL |
expectedOutput string | ||
cluster string | ||
expectedRayClusters []runtime.Object | ||
injectedRayClusters []runtime.Object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
injectedRayClusters []runtime.Object | |
allFakeRayClusters []runtime.Object |
Signed-off-by: fscnick <[email protected]>
Signed-off-by: fscnick <[email protected]>
Signed-off-by: fscnick <[email protected]> Co-authored-by: fscnick <[email protected]>
Why are these changes needed?
Either
--all-namespaces
is true or false onkubectl ray get cluster
, it shows RayClusters in all namespaces. This pr changes the behavior to search the default namespace if--all-namespaces
is false.However, the original behavior seems intentionally. There are some test cases to ensure this behavior. But the original behavior isn't consistent with
get node
andget workergroup
. Additionally, it doesn't align the convention likekubectl get po
which only retrieves the resources from the default namespace instead of all namespaces. Kind correct me if the original behavior is expected.Related issue number
Closes #3806
Checks