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

feature: add Custom columns labels support (#605) #2953

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

crossRT
Copy link

@crossRT crossRT commented Nov 10, 2024

This PR adds a new feature on K9s requested on #605.
Users can define a specific label in the custom column.

Example:

views:
  v1/nodes:
    columns:
      - NAME
      - STATUS
      - PODS
      - LABELS[topology.kubernetes.io/region]

Preview:
image

Description:
I implemented a concept called "ExtractionInfo".
When a custom column is not found in the headers, it will check if it can extract value from another field.
The "ExtractionInfo" will contain the index of the origin column in the field, the header name, and the key to lookup.
I have another struct called "ExtractionInfoBag", which is used to store all these "ExtractionInfo" by using the index of the column in the current field.

Notes:
I'm new to Golang and wish to contribute to the community, but I'm not sure whether my code is good enough.
This is my very first PR, please let me know if any feedback!

@crossRT crossRT force-pushed the add-custom-colums-labels-support branch 2 times, most recently from 74797fa to 4ab2327 Compare November 29, 2024 07:36
@crossRT crossRT force-pushed the add-custom-colums-labels-support branch from 4ab2327 to 4220f9d Compare November 29, 2024 07:48
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