kubestellar / kubeflex

A flexible and scalable platform for running Kubernetes control plane APIs.
Apache License 2.0
46 stars 13 forks source link

bug: kflex init --create-kind fails when checking for kind #61

Closed effi-ofer closed 1 year ago

effi-ofer commented 1 year ago

Describe the bug

(1) The check for whether kind exists in checkIfKindInstalled() fails with Error checking if kind is installed: failed to check kind is installed: exec: "command": executable file not found in $PATH although the command used for the check passes from the command line.

(2) If we pass the above check (by changing the code to explicitly run kind rather than command -v kind) we get the following panic: Installing kubeflex operator...panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]: github.com/kubestellar/kubeflex/pkg/util.ParseVersionNumber({0x223df90?, 0x7f896b679268?}) /home/effi/kubeflex/pkg/util/util.go:69 +0x9c github.com/kubestellar/kubeflex/cmd/kflex/init.ensureKFlexOperator({0x225eaf0, 0xc0004d9410}, {0x223df90?, 0xc0005ae090?}) /home/effi/kubeflex/cmd/kflex/init/init.go:92 +0x49 github.com/kubestellar/kubeflex/cmd/kflex/init.Init({0x225eaf0, 0xc0004d9410}, {0x0, 0x0}, {0x223df90, 0x8}, {0x22418b0, 0x14}) /home/effi/kubeflex/cmd/kflex/init/init.go:54 +0x2ff main.glob..func2(0x31c6160?, {0xc0005abfb0?, 0x1?, 0x1?}) /home/effi/kubeflex/cmd/kflex/main.go:82 +0x6a github.com/spf13/cobra.(Command).execute(0x31c6160, {0xc0005abf90, 0x1, 0x1}) /home/effi/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:920 +0x847 github.com/spf13/cobra.(Command).ExecuteC(0x31c5ba0) /home/effi/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd github.com/spf13/cobra.(*Command).Execute(...) /home/effi/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968 main.main() /home/effi/kubeflex/cmd/kflex/main.go:185 +0x25

Which happens because the version is determined by my git commit level version.gitCommit=120dc46 and is not in the expected format vX.Y.Z.

Steps To Reproduce

On a freshly cloned kubeflex issue:

  1. kflex init --create-kind

Expected Behavior

success

Additional Context

No response