diff --git a/prog/kube-utils/main.go b/prog/kube-utils/main.go index 1ebd098fe1..e0403f7669 100644 --- a/prog/kube-utils/main.go +++ b/prog/kube-utils/main.go @@ -83,6 +83,9 @@ func reclaimRemovedPeers(kube kubernetes.Interface, cml *configMapAnnotations, m return err } nodes, err := getKubePeers(kube, true) + if err != nil { + return err + } nodeSet := make(map[string]struct{}, len(nodes)) for _, node := range nodes { nodeSet[node.name] = struct{}{} @@ -294,9 +297,6 @@ func main() { } return } - if err != nil { - common.Log.Fatalf("[kube-peers] Could not get peers: %v", err) - } if justReclaim { cml := newConfigMapAnnotations(configMapNamespace, configMapName, c) @@ -313,6 +313,9 @@ func main() { return } peers, err := getKubePeers(c, false) + if err != nil { + common.Log.Fatalf("[kube-peers] Could not get peers: %v", err) + } for _, node := range peers { fmt.Println(node.addr) }