You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to switch the context and the namespace at the same time with commands like
pod foo-ns @ctx-dev
pod bar-ns @ctx-test
this only works very sporadically. Often only the context switch is performed and the last namespace of that context used instead.
But sometimes it works on the first try.
Also something strange seems to be happening in the background if it does fail, as switching contexts to another context and back results in the desired namespace being selected.
This seems to me like a race condition between updating the namespace and the loading of the namespace during the context switching.
To Reproduce
Steps to reproduce the behavior:
pod @ctx-test
Choose a namespace in ctx-dev that was not the active one before and run pod foo-ns @ctx-dev
Sometime the namespace foo-ns of ctx-dev is now selected
Otherwise run pod @ctx-test followed by pod @ctx-dev to reach the desired namespace foo-ns
Historical Documents
Debug logs when it works. Starting in context ctx-test, the running :pod foo-ns @ctx-dev:
�[90m2:16PM�[0m �[32mINF�[0m �[1m🐶 K9s starting up...�[0m
�[90m2:16PM�[0m DBG [Namespace] Invalid favorite found 'buzz' - false
# invalid favorite found appears a few times
�[90m2:16PM�[0m DBG Active Context "ctx-test"
�[90m2:16PM�[0m �[32mINF�[0m �[1m✅ Kubernetes connectivity�[0m
# invalid favorite found appears a few times
�[90m2:16PM�[0m DBG No custom skin found. Using stock skin
�[90m2:16PM�[0m DBG Factory START with ns `"bar-ns"
�[90m2:16PM�[0m DBG Fetching latest k9s rev...
�[90m2:16PM�[0m DBG K9s latest rev: "v0.32.5"
�[90m2:16PM�[0m DBG No custom skin found. Using stock skin
�[90m2:16PM�[0m DBG [Namespace] Invalid favorite found 'foobar' - false
�[90m2:16PM�[0m DBG Saved context config for: "ctx-dev"
�[90m2:16PM�[0m DBG Switching context "ctx-dev"
�[90m2:16PM�[0m DBG ClusterInfo updater canceled!
# invalid favorite found appears a few times
�[90m2:16PM�[0m DBG Saved context config for: "ctx-dev"
�[90m2:16PM�[0m DBG Factory START with ns `"foo-ns"
�[90m2:16PM�[0m DBG --> Switching Context "ctx-dev" -- "foo-ns" -- "pod"
�[90m2:16PM�[0m DBG No custom skin found. Using stock skin
�[90m2:16PM�[0m DBG [Namespace] Invalid favorite found 'bar-ns' - false
Debug logs when it only works on the second try context switch. So starting in ctx-test:
pod foo-ns @ctx-dev
pod @ctx-test
pod @ctx-dev
=> now in `foo-ns`
�[90m2:47PM�[0m �[32mINF�[0m �[1m🐶 K9s starting up...�[0m
�[90m2:47PM�[0m DBG Active Context "ctx-test"
�[90m2:47PM�[0m �[32mINF�[0m �[1m✅ Kubernetes connectivity�[0m
# invalid favorite found appears a few times
�[90m2:47PM�[0m DBG No custom skin found. Using stock skin
�[90m2:47PM�[0m DBG Factory START with ns `"bar-ns"
�[90m2:47PM�[0m DBG Fetching latest k9s rev...
�[90m2:47PM�[0m DBG K9s latest rev: "v0.32.5"
�[90m2:47PM�[0m DBG No custom skin found. Using stock skin
# invalid favorite found appears a few times
�[90m2:47PM�[0m DBG Saved context config for: "ctx-dev"
�[90m2:47PM�[0m DBG Switching context "ctx-dev"
�[90m2:47PM�[0m DBG ClusterInfo updater canceled!
# invalid favorite found appears a few times
�[90m2:47PM�[0m DBG Saved context config for: "ctx-dev"
�[90m2:47PM�[0m DBG Factory START with ns `"foo-ns"
�[90m2:47PM�[0m DBG --> Switching Context "ctx-dev" -- "foo-ns" -- "pod previous-ns"
�[90m2:47PM�[0m DBG No custom skin found. Using stock skin
# invalid favorite found appears a few times
�[90m2:47PM�[0m DBG Saved context config for: "ctx-test"
�[90m2:47PM�[0m DBG Switching context "ctx-test"
�[90m2:47PM�[0m DBG ClusterInfo updater canceled!
# invalid favorite found appears a few times
�[90m2:47PM�[0m DBG Saved context config for: "ctx-test"
�[90m2:47PM�[0m DBG Factory START with ns `"bar-ns"
�[90m2:47PM�[0m DBG --> Switching Context "ctx-test" -- "bar-ns" -- "pod"
�[90m2:47PM�[0m DBG No custom skin found. Using stock skin
# invalid favorite found appears a few times
�[90m2:48PM�[0m DBG Saved context config for: "ctx-dev"
�[90m2:48PM�[0m DBG Switching context "ctx-dev"
�[90m2:48PM�[0m DBG ClusterInfo updater canceled!
# invalid favorite found appears a few times
�[90m2:48PM�[0m DBG Saved context config for: "ctx-dev"
�[90m2:48PM�[0m DBG Factory START with ns `"k8s-current-ns"
�[90m2:48PM�[0m DBG --> Switching Context "ctx-dev" -- "k8s-current-ns" -- "pod foo-ns"
�[90m2:48PM�[0m DBG No custom skin found. Using stock skin
# invalid favorite found appears a few times
Expected behavior
The namespace selected in the command is active after the context switch .
Versions:
OS: Ubuntu 22.04
K9s: v0.32.5
K8s: v1.29.4-eks-036c24b
The text was updated successfully, but these errors were encountered:
Describe the bug
When trying to switch the context and the namespace at the same time with commands like
this only works very sporadically. Often only the context switch is performed and the last namespace of that context used instead.
But sometimes it works on the first try.
Also something strange seems to be happening in the background if it does fail, as switching contexts to another context and back results in the desired namespace being selected.
This seems to me like a race condition between updating the namespace and the loading of the namespace during the context switching.
To Reproduce
Steps to reproduce the behavior:
pod @ctx-test
pod foo-ns @ctx-dev
pod @ctx-test
followed bypod @ctx-dev
to reach the desired namespace foo-nsHistorical Documents
Debug logs when it works. Starting in context ctx-test, the running
:pod foo-ns @ctx-dev
:Debug logs when it only works on the second try context switch. So starting in ctx-test:
pod foo-ns @ctx-dev
pod @ctx-test
pod @ctx-dev
Expected behavior
The namespace selected in the command is active after the context switch .
Versions:
The text was updated successfully, but these errors were encountered: