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

Custom columns not working as per docs #1233

Closed
heydonovan opened this issue Aug 17, 2021 · 8 comments
Closed

Custom columns not working as per docs #1233

heydonovan opened this issue Aug 17, 2021 · 8 comments
Labels
question Further information is requested

Comments

@heydonovan
Copy link

heydonovan commented Aug 17, 2021

Hi Team! I'm following the instructions here:

https://github.com/derailed/k9s#resource-custom-columns

And I've a couple questions as I'm unable to get any sort of custom columns working. What is $XDG_CONFIG_HOME? Is that supposed to be $HOME? I've created ~/.k9s/views.yml and tried renaming it to ~/.k9s/views_config.yml, but neither filename have any sort of effect.

$ k9s version --short
Version              0.24.15
Commit               8e41b76edf15f7eddc46cd75fd45d27a30dc9ebe
Date                 n/a

$ cat ~/.k9s/views.yml
k9s:
  views:
    v1/pods:
      columns:
        - AGE
        - TEST
        - NAMESPACE

If I'm able to get this working, my goal is to update the nodes view to break out certain labels into their own columns for easier debugging (which nodes are cpu/io bound, ami labels, docker versions, etc).

Edit: I've read the release notes and looks like we switched to $XDG_CONFIG_HOME. As I don't have it set, the docs say it will default to $HOME/.config. I've added a k9s directory there, and moved the files there as well, but no effect.

$ cat ~/.config/k9s/views.yml
k9s:
  views:
    v1/nodes:
      columns:
        - AGE
        - NAMESPACE
@derailed derailed added the question Further information is requested label Aug 18, 2021
@derailed
Copy link
Owner

@heydonovan Did you change your env to use XDG as specified in the release notes? I think your views should change once the configurations are pulled from the correct place?

@heydonovan
Copy link
Author

@derailed How does one change their env to use XDG? I've uninstalled k9s and re-installed it as I would assume that would use whatever settings it needs to use.

From their docs:

$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

I do not have that set, so it should default to $HOME/.config (which is a dir, not a file).

$ env | grep XDG_CONFIG_HOME

$ cat $HOME/.config/k9s/views.yml
k9s:
  views:
    v1/nodes:
      columns:
        - AGE
        - NAMESPACE

@derailed
Copy link
Owner

@heydonovan If XDG_CONFIG_HOME is left unset it will use the default dir per your OS as specified Here. So in your instance if you want to keep your config dir you can set XDG_CONFIG_HOME=$HOME/.config. Does this make sense?

@heydonovan
Copy link
Author

@derailed Ahh, I read different documentation. I didn't know it would be ~/Library/Application Support.

I've tried that as well, but that doesn't work either:

$ cat ~/Library/Application\ Support/k9s/views.yml
k9s:
  views:
    v1/nodes:
      columns:
        - AGE
        - NAMESPACE

@derailed
Copy link
Owner

@heydonovan Hum... Rats! Assuming you're on a mac... Let's try $HOME/Library/Preferences/k9s/views.yml. Also you can turn on k9s debug logs and see where/if the configs are getting loaded. Hope this helps if not I am in denial and have a bug ;(

@heydonovan
Copy link
Author

heydonovan commented Aug 19, 2021

@derailed That was it! That's the correct location :)

Now that we can set custom columns, can we configure a column to derive its value from a node spec? For example, if I wanted to show ami-0f5796a6388517f14 as a value in an AMI column.

$ kubectl get node/ip-10-100-104-20.ec2.internal -o yaml
apiVersion: v1
kind: Node
metadata:
  annotations:
    node.alpha.kubernetes.io/ttl: "0"
    volumes.kubernetes.io/controller-managed-attach-detach: "true"
  creationTimestamp: "2021-07-12T20:32:59Z"
  labels:
    ami.id: ami-0f5796a6388517f14
$ cat ~/Library/Application\ Support/k9s/views.yml
k9s:
  views:
    v1/nodes:
      columns:
        - AMI = .metadata.labels.ami.id

@luolong
Copy link

luolong commented Sep 13, 2021

Oh, yes, I want that too! This would be specially interesting in the case of custom resource views.

@derailed
Copy link
Owner

@heydonovan Going to close this. Cust cols is a separate feature described in #605

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

No branches or pull requests

3 participants