add Error message when unjoining cluster with a non-existent clustername

Signed-off-by: bruce <zhangyongxi_yewu@cmss.chinamobile.com>
This commit is contained in:
bruce 2022-06-15 10:09:53 +08:00
parent 552864f3ca
commit faf8558b02
1 changed files with 1 additions and 1 deletions

View File

@ -271,7 +271,7 @@ func deleteClusterObject(controlPlaneKarmadaClient *karmadaclientset.Clientset,
err := controlPlaneKarmadaClient.ClusterV1alpha1().Clusters().Delete(context.TODO(), opts.ClusterName, metav1.DeleteOptions{})
if apierrors.IsNotFound(err) {
return nil
return fmt.Errorf("no cluster object %s found in karmada control Plane", opts.ClusterName)
}
if err != nil {
klog.Errorf("Failed to delete cluster object. cluster name: %s, error: %v", opts.ClusterName, err)