Skip to content
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

Accept piped data #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Accept piped data #3

wants to merge 1 commit into from

Conversation

rothgar
Copy link

@rothgar rothgar commented Jun 7, 2021

Here is how I would want to use kubesort. Being able to pipe data into it in addition to using it as a command wrapper could be very useful.

Using bash and sort has some limitations but I think it mostly just works as expected (I didn't test every field)

You can run it without args and it'll default to AGE column

kubectl get po| ./kubesort
NAME                       READY   STATUS    RESTARTS   AGE
nginx2                     1/1     Running   1          29m
nginx                      1/1     Running   2          21h
postgres-0                 1/1     Running   0          4d4h
counter-7b58954fbf-zszkb   1/1     Running   0          4d4h

or run it with a column to sort.

kubectl get po| ./kubesort restarts
NAME                       READY   STATUS    RESTARTS   AGE
counter-7b58954fbf-zszkb   1/1     Running   0          4d4h
postgres-0                 1/1     Running   0          4d4h
nginx2                     1/1     Running   1          29m
nginx                      1/1     Running   2          21h

When you pipe data to it it doesn't limit what fields can be sorted but it does require you to use a header row because that's where it bases the sort argument from.

It might be good to handle tests in case the data is malformed or if kubectl spits out help text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant