-
Notifications
You must be signed in to change notification settings - Fork 953
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
feat: add vcctl pod list #3530
feat: add vcctl pod list #3530
Conversation
53a780d
to
aa25e6e
Compare
/assign @Monokaix |
Please descibe more details about what sub commands and what flags are added by this pr: ) |
done |
Bro, Because of #3524 can not query pod assigned to queue. There are several other job type like deployment , pod needed to query by queue name. Could u plz take |
Ok, I will add this feature |
thanks bro, it is very useful |
f71319e
to
a724316
Compare
a724316
to
05ff66d
Compare
already support in this pr |
869b49e
to
2b0633e
Compare
3d015f9
to
3fea772
Compare
# query by queue name
root@VM-0-14-ubuntu:~/volcano/_output/bin# vcctl pod list -q=test
Name Ready Status Restart Age
job-1-nginx-0 0/1 Completed 0 32h
deploy-with-volcano-bf5784c5f-wrl4k 1/1 Running 0 26h
# query by job name and queue name
root@VM-0-14-ubuntu:~/volcano/_output/bin# vcctl pod list -q=test -j=job-1
Name Ready Status Restart Age
job-1-nginx-0 0/1 Completed 0 32h
# query by job name and queue name, but not match
root@VM-0-14-ubuntu:~/volcano/_output/bin# vcctl pod list -q=aaaa -j=job-1
Failed to list pod: the input vcjob job-1 does not match the queue aaaa |
3fea772
to
a65c3f4
Compare
pkg/cli/pod/pod.go
Outdated
var pods corev1.PodList | ||
|
||
// filter pods based on annotationKey and annotationValue | ||
filterByAnnotationFunc := func(pods *corev1.PodList, annotationKey, annotationValue string) *corev1.PodList { |
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.
Please extract filterByAnnotationFunc and filterByLabelFunc as a seperate func.
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.
fix
pkg/cli/pod/pod.go
Outdated
pods.Items = append(pods.Items, listVcjobPodsRes.Items...) | ||
if listPodFlags.QueueName != "" { | ||
// if queue is specified, check if the queue name used by the pod matches with the one passed in | ||
_, err := filterByLabelFunc(listVcjobPodsRes, v1alpha1.QueueNameKey, listPodFlags.QueueName, true) |
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.
There is no need to set a flag in filterByLabelFunc, which increased
code complexity, just compare pods.Items[0].queueName and listPodFlags.QueueName is ok.
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.
fixed
a65c3f4
to
d41491b
Compare
pkg/cli/pod/pod.go
Outdated
} | ||
|
||
// filterByAnnotationFunc filter pods based on annotationKey and annotationValue | ||
func filterByAnnotationFunc(pods *corev1.PodList, annotationKey, annotationValue string) *corev1.PodList { |
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.
filterByAnnotationFunc => filterPodsByAnnotation
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.
fixed
Signed-off-by: googs1025 <googs1025@gmail.com>
d41491b
to
9f24b28
Compare
@@ -1,3 +1,19 @@ | |||
/* | |||
Copyright 2024 The Volcano Authors. |
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.
It is recommended to remove the year #3668
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.
I think we can remove year in auto generated files: )
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Monokaix The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
New features: support list pod created by vcjob
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes part of: #3495
Special notes for your reviewer:
None
Does this PR introduce a user-facing change?
Added vcctl pod command feature
How to use it:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
None