derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
26.98k stars 1.69k forks source link

Sort containers in declared order #2843

Open ryanbrainard opened 2 months ago

ryanbrainard commented 2 months ago




Is your feature request related to a problem? Please describe. When viewing a pod with multiple containers, they are displayed in alphabetical order instead of the order they are declared in the pod spec. For normal containers this isn't so much of a problem since the order is irrelevant, but for initContainers, the declared order dictates the run order. It would make it much easier to view the pod stepping through the initContainers if they were in run order.

Describe the solution you'd like Provide a sort option for containers to sort by the same order they are declared in the pod spec. Bonus if it's the default, but certainly not a requirement.

Describe alternatives you've considered I guess one could prefix the container names with numbers to make them sort alphabetically.

derailed commented 2 months ago

@ryanbrainard Thank you for this great suggestion Ryan! I like this idea especially in light of more workloads specify multiple init cos.

ryanbrainard commented 1 month ago

@derailed Glad you like it! I have a basic branch of this working and happy to open a PR, but before I do, a few questions:

ryanbrainard commented 1 month ago

@derailed I took a stab at the implemention in https://github.com/derailed/k9s/pull/2878

derailed commented 1 month ago

@ryanbrainard Thank you for the details here Ryan! I'll take a peek at the pr.