Browse code

Return directly if no pods found when evacuating

xiangpengzhao authored on 2016/08/15 15:12:21
Showing 1 changed files
... ...
@@ -89,6 +89,10 @@ func (e *EvacuateOptions) RunEvacuate(node *kapi.Node) error {
89 89
 	if err != nil {
90 90
 		return err
91 91
 	}
92
+	if len(pods.Items) == 0 {
93
+		fmt.Fprint(e.Options.ErrWriter, "\nNo pods found on node: ", node.ObjectMeta.Name, "\n\n")
94
+		return nil
95
+	}
92 96
 	rcs, err := e.Options.Kclient.ReplicationControllers(kapi.NamespaceAll).List(kapi.ListOptions{})
93 97
 	if err != nil {
94 98
 		return err