rancher / kim

In ur kubernetes, buildin ur imagez
Apache License 2.0
326 stars 19 forks source link

kim with colon separated KUBECONFIG env var #81

Closed himslm01 closed 2 years ago

himslm01 commented 2 years ago

As documented here:

https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#set-the-kubeconfig-environment-variable

My KUBECONFIG env var points to three files, like this:

$ echo $KUBECONFIG
/Users/mdsh/.kube/config:/Users/mdsh/.kube/config.d/home/config:/Users/mdsh/.kube/config.d/work/config 

This works as expected with kubectl but kim fail, like this:

$ kim image ls
Error: stat /Users/mdsh/.kube/config:/Users/mdsh/.kube/config.d/home/config:/Users/mdsh/.kube/config.d/work/config: no such file or directory
Usage:
  kim image ls [OPTIONS] [REPOSITORY[:TAG]]

Aliases:
  ls, list

Flags:
  -a, --all        Show all images (default hides tag-less images)
      --digests    Show digests
  -h, --help       help for ls
      --no-trunc   Don't truncate output
  -q, --quiet      Only show image IDs

Global Flags:
  -x, --context string      kubeconfig context for authentication
      --debug               
      --debug-level int     
  -k, --kubeconfig string   kubeconfig for authentication
  -n, --namespace string    namespace (default "kube-image")

FATA[0000] stat /Users/mdsh/.kube/config:/Users/mdsh/.kube/config.d/home/config:/Users/mdsh/.kube/config.d/work/config: no such file or directory 

I have to use the -k parameter to point to a specific config file - which is less than ideal.

$ kim image ls -k /Users/mdsh/.kube/config
jandubois commented 2 years ago

@dweomer This is how kuberlr handles this (by delegating to NewDefaultClientConfigLoadingRules):

https://github.com/flavio/kuberlr/blob/e09d1c6/internal/kubehelper/client.go#L34-L54