derailed / k9s

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

hotkeys ignored #2724

Open aborrero opened 2 months ago

aborrero commented 2 months ago




Describe the bug I created a file with hotkeys configuration like this:

---
hotKeys:
  shift-1:
    shortCut: Shift-1
    description: show namespaces
    command: namespaces

  shift-2:
    shortCut: Shift-2
    description: show deployments
    command: dp

The first hotkey works (shift-1) the second does nothing.

They both show up in the help <?> panel.

Setting k9s in trace mode doesn't show any relevant information in the log file.

To Reproduce

Create file $XDG_DATA_HOME/k9s/hotkeys.yaml with the aforementioned content.

Start k9s, and try the different hotkeys.

Historical Documents N/A

Expected behavior All hotkeys would work.

Screenshots N/A

Versions (please complete the following information):

Additional context N/A

derailed commented 2 months ago

Hum... Strange! I've cp your hotkeys spec on v0.32.4 and it works as prescribed?? Did you check the k9s debug logs for potential load issues or conflicts?

aborrero commented 2 months ago

The trace-level logs:

10:29AM INF 🐶 K9s starting up...
10:29AM ERR Fail to locate metrics-server error="No metrics api group metrics.k8s.io found on cluster"
10:29AM TRC [CAN] v1/namespaces(""/"") <[list]>
10:29AM TRC   Spec: v1.SelfSubjectAccessReviewSpec{ResourceAttributes:(*v1.ResourceAttributes)(0xc000eda310), NonResourceAttributes:(*v1.NonResourceAttributes)(nil)}
10:29AM TRC   Auth: true [""]
10:29AM TRC   <<<nil>>>
10:29AM DBG Active Context "kind-toolforge"
10:29AM INF ✅ Kubernetes connectivity
10:29AM DBG [Skin] Loading global skin ("kanagawa")
10:29AM DBG Loading skin file: "/home/arturo/.config/k9s/skins/kanagawa.yaml"
10:29AM DBG Factory START with ns `"api-gateway"
10:29AM TRC [CAN] v1/nodes(""/"") <[list]>
10:29AM TRC   Spec: v1.SelfSubjectAccessReviewSpec{ResourceAttributes:(*v1.ResourceAttributes)(0xc000e84d20), NonResourceAttributes:(*v1.NonResourceAttributes)(nil)}
10:29AM TRC   Auth: true [""]
10:29AM TRC   <<<nil>>>
10:29AM DBG Fetching latest k9s rev...
10:29AM DBG K9s latest rev: "v0.32.4"
10:29AM TRC [CAN] apiextensions.k8s.io/v1/customresourcedefinitions(""/"") <[list]>
10:29AM TRC   Spec: v1.SelfSubjectAccessReviewSpec{ResourceAttributes:(*v1.ResourceAttributes)(0xc0003222a0), NonResourceAttributes:(*v1.NonResourceAttributes)(nil)}
10:29AM TRC   Auth: true [""]
10:29AM TRC   <<<nil>>>
10:29AM DBG [Skin] Loading global skin ("kanagawa")
10:29AM DBG Loading skin file: "/home/arturo/.config/k9s/skins/kanagawa.yaml"
10:29AM TRC [CAN] v1/namespaces("api-gateway"/"") <[list]>
10:29AM TRC   Spec: v1.SelfSubjectAccessReviewSpec{ResourceAttributes:(*v1.ResourceAttributes)(0xc00031c1c0), NonResourceAttributes:(*v1.NonResourceAttributes)(nil)}
10:29AM TRC   Auth: true [""]
10:29AM TRC   <<<nil>>>
10:29AM TRC Refresh [v1/namespaces](0) 13.182µs 
10:29AM TRC Refresh [v1/namespaces](21) 479.695µs 
10:29AM TRC Refresh [v1/namespaces](21) 765.295µs 
10:29AM TRC Refresh [v1/namespaces](21) 609.77µs 
10:29AM TRC Refresh [v1/namespaces](21) 803.13µs 
10:29AM TRC Refresh [v1/namespaces](21) 288.609µs 
10:29AM TRC Refresh [v1/namespaces](21) 769.23µs 
10:29AM TRC Refresh [v1/namespaces](21) 404.898µs 
10:29AM TRC Refresh [v1/namespaces](21) 888.605µs 
10:29AM TRC Refresh [v1/namespaces](21) 250.267µs 
10:29AM TRC Refresh [v1/namespaces](21) 411.942µs 
10:29AM TRC Refresh [v1/namespaces](21) 995.492µs 
10:29AM TRC Refresh [v1/namespaces](21) 244.793µs 
melkishengue commented 2 weeks ago

I got the same issue. I see this in the k9s logs:

4:54PM INF ✅ Kubernetes connectivity
4:55PM WRN Hotkeys load failed: invalid key specified: ""

with the following hotkeys file:

hotKeys:
  shift-0:
    shortCut:    Shift-0
    description: Viewing pods
    command: pods
  shift-1:
    shortcut: Shift-1
    description: View services
    command:     services
  shift-2:
    shortCut:    Shift-2
    description: View kustomizations
    command:     kustomizations
  shift-3:
    shortCut:    Shift-3
    description: Viewing git repositories
    command:     gitrepositories
  shift-4:
    shortCut:    Shift-4
    description: View Loki Pods
    command:     pods /loki

k9s version: 0.32.3