-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
If the k8s config.yml is owned by root, k9s will throw Boom!! runtime error: invalid memory address or nil pointer dereference. because this check doesn't check for os.IsPermission, so f will be nil.
Logs:
9:53PM ERR Boom! runtime error: invalid memory address or nil pointer dereference
9:53PM ERR goroutine 1 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x64
github.com/derailed/k9s/cmd.run.func2()
github.com/derailed/k9s/cmd/root.go:97 +0x9c
panic({0x1032f3ee0?, 0x105459370?})
runtime/panic.go:914 +0x218
github.com/derailed/k9s/internal/config/data.(*Dir).Load(0x14000c2c1c8, {0x14000988a00?, 0x3c?}, 0x1400088d450)
github.com/derailed/k9s/internal/config/data/dir.go:42 +0xe0
github.com/derailed/k9s/internal/config.(*K9s).ActivateContext(0x1400075c000, {0x14000988a00, 0x3c})
github.com/derailed/k9s/internal/config/k9s.go:207 +0x68
github.com/derailed/k9s/internal/config.(*Config).Refine(0x14000e6e780, 0x14000e64120, 0x1400009c600, 0x140002df720?)
github.com/derailed/k9s/internal/config/config.go:79 +0x168
github.com/derailed/k9s/cmd.loadConfiguration()
github.com/derailed/k9s/cmd/root.go:141 +0x394
github.com/derailed/k9s/cmd.run(0x14000af4200?, {0x10247a874?, 0x4?, 0x10247a79c?})
github.com/derailed/k9s/cmd/root.go:107 +0x37c
github.com/spf13/cobra.(*Command).execute(0x105489a60, {0x1400004c0b0, 0x0, 0x0})
github.com/spf13/[email protected]/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x105489a60)
github.com/spf13/[email protected]/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/[email protected]/command.go:1039
github.com/derailed/k9s/cmd.Execute()
github.com/derailed/k9s/cmd/root.go:70 +0x24
main.main()
github.com/derailed/k9s/main.go:32 +0x1c
To Reproduce
Steps to reproduce the behavior:
chownyour k8s config.yml to root- run k9s
Expected behavior
I think in this case, a helpful error message would be desired, instead of a panic.
Can also suggest something like run k9s with sudo, or chown your config or something.
Versions (please complete the following information):
- OS: OSX
- K9s: v0.31.9
- K8s:
Client Version: v1.27.2
Kustomize Version: v5.0.1
Server Version: v1.28.5-eks-5e0fdde
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working