rancher / kim

In ur kubernetes, buildin ur imagez
Apache License 2.0
326 stars 19 forks source link

Index out of range panic #60

Closed mattfarina closed 3 years ago

mattfarina commented 3 years ago

While using KIM inside Rancher Desktop I encountered the following panic. I've not traced the issue, yet, but wanted to report it. We use KIM as part of our setup process to make sure the builder is present.

time="2021-06-07T16:52:40-04:00" level=warning msg="Cannot find available builder daemon, attempting automatic installation..."
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/rancher/kim/pkg/client/builder.(*Install).NodeRole(0xc0003aa180, 0x2c784b0, 0xc0000e9b00, 0xc000339310, 0xc0000e9b00, 0xc0001d66a0)
    /drone/src/pkg/client/builder/install.go:527 +0x416
github.com/rancher/kim/pkg/client/builder.(*Install).Do(0xc0003aa180, 0x2c78440, 0xc0000e9b00, 0xc000339310, 0x0, 0x0)
    /drone/src/pkg/client/builder/install.go:49 +0xcc
github.com/rancher/kim/pkg/cli/command/image.(*CommandSpec).PersistentPre(0x3918788, 0xc0008518c0, 0xc0003cefd0, 0x0, 0x1, 0x0, 0x0)
    /drone/src/pkg/cli/command/image/image.go:65 +0x1bb
github.com/rancher/wrangler-cli.bind.func1(0xc0008518c0, 0xc0003cefd0, 0x0, 0x1, 0x0, 0x0)
    /go/pkg/mod/github.com/rancher/wrangler-cli@v0.0.0-20210217230406-95cfa275f52f/builder.go:270 +0x15d
github.com/rancher/kim/pkg/cli.AddShortcut.func1(0xc0008518c0, 0xc0003cefd0, 0x0, 0x1, 0x0, 0x0)
    /drone/src/pkg/cli/cli.go:124 +0x57
github.com/spf13/cobra.(*Command).execute(0xc0008518c0, 0xc0003cefc0, 0x1, 0x1, 0xc0008518c0, 0xc0003cefc0)
    /go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:829 +0x582
github.com/spf13/cobra.(*Command).ExecuteC(0xc000449340, 0xc00012a010, 0x2c78440, 0xc000348200)
    /go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:895
github.com/spf13/cobra.(*Command).ExecuteContext(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:888
github.com/rancher/wrangler-cli.Main(0xc000449340)
    /go/pkg/mod/github.com/rancher/wrangler-cli@v0.0.0-20210217230406-95cfa275f52f/builder.go:73 +0x6d
main.main()
    /drone/src/main.go:29 +0xd4
dweomer commented 3 years ago

@mattfarina this looks like improper handling of the case (in my code) where the supplied node selector nets zero results. Is desktop running kim builder install --selector=<something>?