siderolabs / omni

SaaS-simple deployment of Kubernetes - on your own hardware.
Other
574 stars 36 forks source link

[bug] omnictl error during config merge #683

Open danktec opened 1 month ago

danktec commented 1 month ago

Is there an existing issue for this?

Current Behavior

omnictl config merge ~/.config/omni/config/omniconfig.yaml
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe441fb]

goroutine 1 [running]:
github.com/siderolabs/omni/client/pkg/omnictl/config.(*Config).Merge(0x0, {0x7ffd1db8d6e2?, 0x1?})
    /src/client/pkg/omnictl/config/config.go:164 +0x19b
github.com/siderolabs/omni/client/pkg/omnictl.init.func8(0xc000418d00?, {0xc0003fa7b0, 0x1, 0x141b93c?})
    /src/client/pkg/omnictl/config.go:193 +0x74
github.com/spf13/cobra.(*Command).execute(0x21bd620, {0xc0003fa780, 0x1, 0x1})
    /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0x21bed20)
    /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x142d702?)
    /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041 +0x13
main.main()
    /src/cmd/omnictl/main.go:25 +0x171

Expected Behavior

No error

Steps To Reproduce

omnictl -v
omnictl version v0.42.3 (API Version: 1)

linux-amd64

What browsers are you seeing the problem on?

No response

Anything else?

No response

alongwill commented 1 month ago

@danktec what is OMNICONFIG set to? Can you include the file contents too please?

DmitriyMV commented 1 month ago

Greetings! Yeah, thats a bug which should be fixes by this PR, but it actually hides some other error.

DmitriyMV commented 1 month ago

Not exactly closed, since we don't know the underlying error.

danktec commented 1 month ago
cat ~/.config/omni/config/omniconfig.yaml
contexts:
    default:
        url: https://[tenant].omni.siderolabs.io
        auth:
            siderov1:
                identity: dan@tenant.com
context: default
mrkhachaturov commented 1 month ago

Getting the same error. omnictl is installed on Ubuntu omnictl version v0.43.3 (API Version: 1) omniconfig.yaml placed in this path ~/.config/omni/config/omniconfig.yaml. Configuration is correct; the same works correctly on macOS

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x102b51b]

goroutine 1 [running]:
github.com/siderolabs/omni/client/pkg/omnictl/config.(*Config).Merge(0x0, {0x7ffc3f18b624?, 0x1?})
        /src/client/pkg/omnictl/config/config.go:164 +0x19b
github.com/siderolabs/omni/client/pkg/omnictl.init.func8(0xc0004f8600?, {0xc0004e0680, 0x1, 0x16849e6?})
        /src/client/pkg/omnictl/config.go:193 +0x74
github.com/spf13/cobra.(*Command).execute(0x264db60, {0xc0004e0650, 0x1, 0x1})
        /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0x264f260)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x1697c9d?)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041 +0x13
main.main()
        /src/cmd/omnictl/main.go:25 +0x171

If someone following this post to install and configure omnictl just use this command: export OMNICONFIG=~/.config/omni/config/omniconfig.yaml

DmitriyMV commented 1 month ago

@mrkhachaturov Something is wrong. The stacktrace you show is from omnictl 0.42.0. Could you double check pls?

mrkhachaturov commented 1 month ago

@mrkhachaturov Something is wrong. The stacktrace you show is from omnictl 0.42.0. Could you double check pls?

rkadmin@runner:~$ omnictl -v
omnictl version v0.43.3 (API Version: 1)
rkadmin@runner:~$ mkdir -p ~/.config/omni/config
rkadmin@runner:~$ nano omniconfig.yaml
rkadmin@runner:~$ cp omniconfig.yaml ~/.config/omni/config
rkadmin@runner:~$ omnictl config merge ./omniconfig.yaml
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x102b51b]

goroutine 1 [running]:
github.com/siderolabs/omni/client/pkg/omnictl/config.(*Config).Merge(0x0, {0x7ffdfb988465?, 0x1?})
        /src/client/pkg/omnictl/config/config.go:164 +0x19b
github.com/siderolabs/omni/client/pkg/omnictl.init.func8(0xc000500700?, {0xc0004e2690, 0x1, 0x16849e6?})
        /src/client/pkg/omnictl/config.go:193 +0x74
github.com/spf13/cobra.(*Command).execute(0x264db60, {0xc0004e2660, 0x1, 0x1})
        /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0x264f260)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x1697c9d?)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041 +0x13
main.main()
        /src/cmd/omnictl/main.go:25 +0x171
rkadmin@runner:~$
mrkhachaturov commented 1 month ago

@mrkhachaturov Something is wrong. The stacktrace you show is from omnictl 0.42.0. Could you double check pls?

This issue arises when you follow the instruction to Install and Configure Omnictl.

We must first define the OMNICONFIG path. When I define export OMNICONFIG=~/.config/omni/config/omniconfig.yaml, everything worked as expected.

The merge functionality is also working after defining OMNICONFIG

I have made PR to include this in documantation.