derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
27.58k stars 1.74k forks source link

Cli argument `-n` / `--namespace` ignored #2722

Closed landorg closed 6 months ago

landorg commented 6 months ago




Describe the bug When I start the latest k9s version (v0.32.4) with -n datadog it is ignored and instead k9s uses the active namespace from the context config.

To Reproduce Steps to reproduce the behavior:

  1. Run
    k9s -n <namespace>

Expected behavior Open resources in namespace

Versions (please complete the following information):

derailed commented 6 months ago

Can't seem to repro this ;( Works a prescribed here at the ranch k9s -n nsx overrides default ns in active context when set. Did you check the k9s debug logs?

landorg commented 6 months ago

:thinking: Checking this again I am unsure. Might be a misunderstanding on my side:

❯ k9s -n cs --logLevel debug
# here I get to the namespace view

❯ cat ~/.local/state/k9s/k9s.log
1:44PM INF 🐶 K9s starting up...
1:44PM DBG [Namespace] Invalid favorite found 'terraform' - false
1:44PM DBG Active Context "pre-production"
1:44PM INF ✅ Kubernetes connectivity
1:44PM DBG [Skin] Loading global skin ("gruvbox-dark")
1:44PM DBG Loading skin file: "/home/user/.config/k9s/skins/gruvbox-dark.yaml"
1:44PM DBG Factory START with ns `"cs"
1:44PM DBG Fetching latest k9s rev...
1:44PM DBG K9s latest rev: "v0.32.4"
1:44PM DBG [Skin] Loading global skin ("gruvbox-dark")
1:44PM DBG Loading skin file: "/home/user/.config/k9s/skins/gruvbox-dark.yaml"
1:44PM DBG ConfigWatcher watching: "/home/user/.config/k9s/config.yaml"
1:44PM DBG ConfigWatcher watching: "/home/user/.local/share/k9s/clusters/pre-production/pre-production/config.yaml"
1:44PM DBG SkinWatcher watching "/home/user/.config/k9s/skins"
1:44PM WRN CustomView watcher failed error="no such file or directory"

❯ k9s -n cs --logLevel debug -c pod
# brings me to the pod view in the correct ns

❯ k9s -n cs --logLevel debug
# brings me again to the proper pod view

I think we can close it. When a non namespaced resource is selected the -n is obviously ignored.