-
Notifications
You must be signed in to change notification settings - Fork 223
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
[kueuectl] Added kueuectl list pods command #2280
base: main
Are you sure you want to change the base?
[kueuectl] Added kueuectl list pods command #2280
Conversation
Welcome @Kavinraja-G! |
Hi @Kavinraja-G. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
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.
Don't forget to add docs here.
/assign |
/ok-to-test |
b83d793
to
eb80584
Compare
/test pull-kueue-test-e2e-main-1-27 |
029344f
to
824da48
Compare
@@ -41,6 +41,11 @@ func NewTestClientGetter() *TestClientGetter { | |||
} | |||
} | |||
|
|||
func (f *TestClientGetter) WithRestMapper(mapper meta.RESTMapper) *TestClientGetter { |
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.
We already have WithRESTMapper
.
if len(o.LabelSelector) != 0 { | ||
o.PodLabelSelector = "," + o.PodLabelSelector | ||
} |
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.
if len(o.LabelSelector) != 0 { | |
o.PodLabelSelector = "," + o.PodLabelSelector | |
} | |
podLabelSelector := o.PodLabelSelector | |
if len(o.LabelSelector) != 0 { | |
podLabelSelector = "," + o.PodLabelSelector | |
} |
FieldSelectorParam(o.FieldSelector). | ||
LabelSelectorParam(o.LabelSelector+o.PodLabelSelector). | ||
ResourceTypeOrNameArgs(true, "pods"). | ||
ContinueOnError(). |
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.
ContinueOnError(). | |
ContinueOnError(). | |
RequestChunksOf(o.Limit). |
func (o *PodOptions) transformRequests(req *rest.Request) { | ||
req.SetHeader("Accept", strings.Join([]string{ | ||
fmt.Sprintf("application/json;as=Table;v=%s;g=%s", metav1.SchemeGroupVersion.Version, metav1.GroupName), | ||
fmt.Sprintf("application/json;as=Table;v=%s;g=%s", metav1beta1.SchemeGroupVersion.Version, metav1beta1.GroupName), |
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.
fmt.Sprintf("application/json;as=Table;v=%s;g=%s", metav1beta1.SchemeGroupVersion.Version, metav1beta1.GroupName), |
Do we need it?
Run: func(cmd *cobra.Command, args []string) { | ||
cobra.CheckErr(o.Complete(clientGetter)) | ||
if o.ForObject != nil { | ||
cobra.CheckErr(o.Run(cmd.Context(), clientGetter)) | ||
} | ||
}, |
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.
Run: func(cmd *cobra.Command, args []string) { | |
cobra.CheckErr(o.Complete(clientGetter)) | |
if o.ForObject != nil { | |
cobra.CheckErr(o.Run(cmd.Context(), clientGetter)) | |
} | |
}, | |
RunE: func(cmd *cobra.Command, args []string) error { | |
cmd.SilenceUsage = true | |
err := o.Complete(clientGetter) | |
if err != nil { | |
return err | |
} | |
if o.ForObject == nil { | |
return nil | |
} | |
return o.Run(clientGetter) | |
}, |
We already fixed another commands #2578.
belonging to the specified namespace, matching | ||
the label selector or the field selector.` |
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.
belonging to the specified namespace, matching | |
the label selector or the field selector.` | |
belonging to the specified namespace, matching | |
the label selector or the field selector.` |
To do not add tabs on --help
.
} | ||
|
||
// fetchDynamicResourceInfos builds and executes a dynamic client query for a resource specified in --for | ||
func (o *PodOptions) fetchDynamicResourceInfos(clientGetter util.ClientGetter) ([]*resource.Info, error) { |
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.
Maybe...
func (o *PodOptions) fetchDynamicResourceInfos(clientGetter util.ClientGetter) ([]*resource.Info, error) { | |
func (o *PodOptions) getForObjectInfos(clientGetter util.ClientGetter) ([]*resource.Info, error) { |
} | ||
|
||
// getPodsUsingAPI gets the pods raw infos directly from the API server | ||
func (o *PodOptions) getPodsUsingAPI(clientGetter util.ClientGetter) ([]*resource.Info, error) { |
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.
And...
func (o *PodOptions) getPodsUsingAPI(clientGetter util.ClientGetter) ([]*resource.Info, error) { | |
func (o *PodOptions) getPodsInfos(clientGetter util.ClientGetter) ([]*resource.Info, error) { |
clientset := k8sfake.NewSimpleClientset() | ||
tf.K8sClientset = clientset | ||
tf.K8sClientset.Discovery().(*fakediscovery.FakeDiscovery).Resources = tc.apiResourceLists |
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.
clientset := k8sfake.NewSimpleClientset() | |
tf.K8sClientset = clientset | |
tf.K8sClientset.Discovery().(*fakediscovery.FakeDiscovery).Resources = tc.apiResourceLists |
Looks like we don't need it more?
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.
Could you also add test case for pod groups?
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds
kueuectl list pods --for job/job-name
. This will help users to list all the pods controlled by a specificJob
in a namespace.Which issue(s) this PR fixes:
Fixes #2204
Special notes for your reviewer:
Nil
Does this PR introduce a user-facing change?