From cb1e9bc870b367d2a76c6d9f36f3b4a85f5d23a5 Mon Sep 17 00:00:00 2001 From: "Johannes M. Scheuermann" Date: Wed, 23 Mar 2022 16:47:29 +0000 Subject: [PATCH] Check if we have at least one Pod --- kubectl-fdb/cmd/exclusion_status.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kubectl-fdb/cmd/exclusion_status.go b/kubectl-fdb/cmd/exclusion_status.go index ef644ecd9..6c55e0609 100644 --- a/kubectl-fdb/cmd/exclusion_status.go +++ b/kubectl-fdb/cmd/exclusion_status.go @@ -22,6 +22,7 @@ package cmd import ( "encoding/json" + "fmt" "sort" "time" @@ -81,6 +82,10 @@ func newExclusionStatusCmd(streams genericclioptions.IOStreams) *cobra.Command { return err } + if len(pods.Items) == 0 { + return fmt.Errorf("no running Pods are found for cluster: %s/%s", cluster.Namespace, cluster.Name) + } + // TODO get the pod randomly err = getExclusionStatus(cmd, config, clientSet, pods.Items[0].Name, namespace, ignoreFullyExcluded, interval) if err != nil {