kubernetes-sigs / cri-tools

CLI and validation tools for Kubelet Container Runtime Interface (CRI) .
Apache License 2.0
1.63k stars 445 forks source link

Support namespace option in `crictl ps` #1494

Open linrl3 opened 1 month ago

linrl3 commented 1 month ago

What would you like to be added:

Add a flag option in crictl ps command. In https://github.com/kubernetes-sigs/cri-tools/blob/master/cmd/crictl/util.go#L107 there is a podNamespaceRegexp option. But I didn't understand why we don't have it in flag option. I could create a PR if the it is needed.

Why is this needed:

After adding this, we can filter by namespace.

### Tasks
saschagrunert commented 1 month ago

@linrl3 thank you for the request! :pray: I think the reason is that the pod usually carries the information about the namespace. Means we probably need an additional RPC on container list to check in which namespace the pod of the container resides. I'm not sure about that, but you're free to propose the change as a PR.