diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/aws/tasks/importCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/aws/tasks/importCluster.go index 2b11c9019e..0b6bd796d4 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/aws/tasks/importCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/aws/tasks/importCluster.go @@ -103,15 +103,6 @@ func ImportClusterNodesTask(taskID string, stepName string) error { return retErr } - // import cluster instances - err = importClusterInstances(basicInfo) - if err != nil { - blog.Errorf("ImportClusterNodesTask[%s]: importClusterInstances failed: %v", taskID, err) - retErr := fmt.Errorf("importClusterInstances failed, %s", err.Error()) - _ = state.UpdateStepFailure(start, stepName, retErr) - return retErr - } - // update cluster masterNodes info err = cloudprovider.GetStorageModel().UpdateCluster(context.Background(), basicInfo.Cluster) if err != nil { diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/importCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/importCluster.go index eb89cca59e..ed1898ca14 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/importCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/importCluster.go @@ -205,11 +205,6 @@ func importClusterInstances(data *cloudprovider.CloudDependBasicInfo) error { } } - err = importClusterNodesToCM(context.Background(), nodes.Items, data.Cluster.ClusterID) - if err != nil { - return err - } - return nil } diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/blueking/tasks/importCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/blueking/tasks/importCluster.go index 20ba484bd6..b4fff621dc 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/blueking/tasks/importCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/blueking/tasks/importCluster.go @@ -173,6 +173,11 @@ func importClusterInstances(data *cloudprovider.CloudDependBasicInfo) error { data.Cluster.Master = masterNodes // data.Cluster.Status = icommon.StatusRunning + // 导入方式是 kubeconfig 集群节点不写入数据库 + if data.Cluster.ImportCategory == icommon.KubeConfigImport { + return nil + } + err = importClusterNodesToCM(context.Background(), nodeIPs, &cloudprovider.ListNodesOption{ Common: data.CmOption, ClusterVPCID: data.Cluster.VpcID, diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/google/tasks/importCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/google/tasks/importCluster.go index f73018e974..3616d0b199 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/google/tasks/importCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/google/tasks/importCluster.go @@ -61,15 +61,6 @@ func ImportClusterNodesTask(taskID string, stepName string) error { return retErr } - // import cluster instances - err = importClusterInstances(basicInfo) - if err != nil { - blog.Errorf("ImportClusterNodesTask[%s]: importClusterInstances failed: %v", taskID, err) - retErr := fmt.Errorf("importClusterInstances failed, %s", err.Error()) - _ = state.UpdateStepFailure(start, stepName, retErr) - return retErr - } - // update cluster masterNodes info _ = cloudprovider.GetStorageModel().UpdateCluster(context.Background(), basicInfo.Cluster) diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/huawei/tasks/importCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/huawei/tasks/importCluster.go index b3792445b9..7185e85037 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/huawei/tasks/importCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/huawei/tasks/importCluster.go @@ -142,15 +142,6 @@ func ImportClusterNodesTask(taskID string, stepName string) error { return retErr } - // import cluster instances - err = importClusterInstances(basicInfo) - if err != nil { - blog.Errorf("ImportClusterNodesTask[%s]: importClusterInstances failed: %v", taskID, err) - retErr := fmt.Errorf("importClusterInstances failed, %s", err.Error()) - _ = state.UpdateStepFailure(start, stepName, retErr) - return retErr - } - // update cluster masterNodes info err = cloudprovider.GetStorageModel().UpdateCluster(context.Background(), basicInfo.Cluster) if err != nil { diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/tasks/importCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/tasks/importCluster.go index bc33bfa0d3..7878656443 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/tasks/importCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/tasks/importCluster.go @@ -419,21 +419,6 @@ func importClusterInstances(data *cloudprovider.CloudDependBasicInfo) ([]string, data.Cluster.Master = masterNodes } - err = importClusterNodesToCM(context.Background(), nodeInfos, &cloudprovider.ListNodesOption{ - Common: data.CmOption, - ClusterVPCID: data.Cluster.VpcID, - ClusterID: data.Cluster.ClusterID, - NodeTemplateID: func() string { - if data.NodeTemplate != nil { - return data.NodeTemplate.NodeTemplateID - } - return "" - }(), - }) - if err != nil { - return nil, nil, err - } - return masterIPs, nodeIPs, nil } diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud/tasks/importCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud/tasks/importCluster.go index f54d968a41..12afa6fe58 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud/tasks/importCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud/tasks/importCluster.go @@ -63,17 +63,6 @@ func ImportClusterNodesTask(taskID string, stepName string) error { return retErr } - // import cluster instances - err = importClusterInstances(basicInfo) - if err != nil { - cloudprovider.GetStorageModel().CreateTaskStepLogError(context.Background(), taskID, stepName, - fmt.Sprintf("import cluster instances failed [%s]", err)) - blog.Errorf("ImportClusterNodesTask[%s]: importClusterInstances failed: %v", taskID, err) - retErr := fmt.Errorf("importClusterInstances failed, %s", err.Error()) - _ = state.UpdateStepFailure(start, stepName, retErr) - return retErr - } - // update cluster masterNodes info err = cloudprovider.GetStorageModel().UpdateCluster(context.Background(), basicInfo.Cluster) if err != nil {