Closed rbo closed 3 years ago
Thanks for reporting. Do you have a sanitized version of that kubeconfig so that I can reproduce it?
Oh yes of course:
$ cat ~/.kube/config
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://api.vmw.example.com:6443
name: api-vmw-example-com:6443
contexts:
- context:
cluster: api-vmw-example-com:6443
namespace: windows-container
user: kube:admin/api-vmw-example-com:6443
name: windows-container/api-vmw-example-com:6443/kube:admin
- context:
cluster: api-vmw-example-com:6443
namespace: windows-workload
user: kube:admin/api-vmw-example-com:6443
name: windows-workload/api-vmw-example-com:6443/kube:admin
current-context: demo-app/api-demo-openshift-pub:6443/admin
kind: Config
preferences: {}
users:
- name: kube:admin/api-vmw-example-com:6443
user:
token: sha256~A518ZtBiOcuyuYuYWk96-NTgZaJh_vfqomZ-SyXTNpc
$ cat ~/.kube/switch-config.yaml
kind: SwitchConfig
version: v1alpha1
kubeconfigStores:
- kind: filesystem
id: local
refreshIndexAfter: 3h
paths:
- ~/.kube/config
$ kubectx
windows-container/api-vmw-example-com:6443/kube:admin
windows-workload/api-vmw-example-com:6443/kube:admin
$ switch list-contexts
.kube/kube:admin
It should be fixed on the current master branch. The problem was the slashes in the context names.
Could you check if it works for you now from the master branch? Thanks!
LGTM
Is it possible to disable the kubeconfig preview on the right side?
Yep, you can use switch --show-preview false
.
I am also working on a flag in the switch-config.
Ah thanks, but the left part is still shortened.
Ah thanks, but the left part is still shortened.
Did you build from the current master? At least for me it works with your provided example kubeconfig.
switch list-contexts | grep windows
dev/windows-workload/api-vmw-example-com:6443/kube:admin
dev/windows-container/api-vmw-example-com:6443/kube:admin
Also try to remove the cache via rm -rf .kube/switch-state
list-contexts works, here what I mean:
./switcher_linux_amd64 list-contexts |grep example
.kube/windows-container/api-vmw-example-com:6443/kube:admin
.kube/windows-workload/api-vmw-example-lloooooooooonnnnnnggggggggggggg-com:6443/kube:admin
should be fixed with this commit
Let me know if that works for you :)
Rebuild from master and looks great!
Yep, you can use
switch --show-preview false
. I am also working on a flag in the switch-config.
Just-for-information:
$ ./hack/switch/switcher_linux_amd64 --show-preview false
Error: context with name "false" not found
context with name "false" not found$
--show-preview=false
\n
after the error message. I have only one kubeconfig in ~/.kube/config
it is possible to disable the .kube
prefix?
You have to use --show-preview=false
Only for the switcher binary.
The user interacts with the switch.sh script callable with switch
.
This is where you need to use
switch --show-preview false
You can now also achieve the same thing via the config file with the latest master.
I have only one kubeconfig in ~/.kube/config it is possible to disable the .kube prefix?
I'll have to think about a good way to do that. I guess it makes sense that it is configurable. Could you open a dedicated issue for it? Thanks!
Done, i guess we can close this Issue.
Thank you very much for your support!
Hi,
is that only me or is kubeswitch using any shortened context name?
Here an example:
my switch configuration
switch version
I would like to see the whole context name.
Thanks for any advice Cheers Robert