diff --git a/driver/kubernetes/podchooser/podchooser.go b/driver/kubernetes/podchooser/podchooser.go index 66984e06..059d0aec 100644 --- a/driver/kubernetes/podchooser/podchooser.go +++ b/driver/kubernetes/podchooser/podchooser.go @@ -6,6 +6,7 @@ import ( "sort" "time" + "github.com/pkg/errors" "github.com/serialx/hashring" "github.com/sirupsen/logrus" appsv1 "k8s.io/api/apps/v1" @@ -29,6 +30,9 @@ func (pc *RandomPodChooser) ChoosePod(ctx context.Context) (*corev1.Pod, error) if err != nil { return nil, err } + if len(pods) == 0 { + return nil, errors.New("no running buildkit pods found") + } randSource := pc.RandSource if randSource == nil { randSource = rand.NewSource(time.Now().Unix())