kubestellar: bug: `kflex ctx` does not work after that context is renamed

Describe the bug

I am debugging deploy-on-k3d.md and having trouble with the kubeflex hosting context after it is renamed. Here is a demonstration of the problem, showing that kflex ctx switches the current context to the original hosting context name regardless of any renaming that it has been through since then.

mspreitz@mjs13 testks % kubectl config get-contexts | fgrep \*
*         kubeflex                                                                               k3d-kubeflex                                     admin@k3d-kubeflex                                                                

mspreitz@mjs13 testks % kubectl config rename-context kubeflex kf
Context "kubeflex" renamed to "kf".

mspreitz@mjs13 testks % kubectl config current-context
kf

mspreitz@mjs13 testks % kflex ctx
✔ Checking for saved initial context...
✔ Switching to initial context...

mspreitz@mjs13 testks % kubectl config current-context
kind-kubeflex

mspreitz@mjs13 testks % kubectl config get-contexts | grep kubeflex
          kf                                                                                     k3d-kubeflex                                     admin@k3d-kubeflex                                                                

Steps To Reproduce

See above.

Expected Behavior

Not sure.

Additional Context

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

We could have kflex ctx-list to avoid that trap. I thought also about kflex ctx --list but that does not sound right as list is a command not an option, and a list command can have also options.