同步容器集群信息

iida
tanshaolong 2024-09-04 14:50:38 +08:00
parent a56102c285
commit 16215dcda5
2 changed files with 25 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
@ -29,7 +30,6 @@ public class ContainerClusterModel {
private String resourceGroupUuid;
private String serviceCidr;
private Long businessId;
private List<ContainerNodeModel> nodeModels;
private List<ContainerNodePoolModel> nodePoolModels;
}

View File

@ -10,6 +10,7 @@ import com.bocloud.ctstack.plugin.provider.TianyiProvider;
import com.bocloud.ctstack.plugin.provider.compute.TianyiImageProvider;
import com.bocloud.ctstack.plugin.provider.compute.TianyiServerProvider;
import com.bocloud.ctstack.plugin.provider.container.TianYiContainerClusterProvider;
import com.bocloud.ctstack.plugin.provider.container.TianYiContainerNodeProvider;
import com.bocloud.ctstack.plugin.provider.database.TianyiRdsProvider;
import com.bocloud.ctstack.plugin.provider.network.TianyiFloatingIpProvider;
import com.bocloud.ctstack.plugin.provider.network.TianyiSecurityGroupProvider;
@ -284,13 +285,32 @@ public class TianyiLocationProvider extends TianyiProvider {
}
// 同步镜像
// 同步容器
log.info("获取容器信息...");
TianYiContainerClusterProvider tianYiContainerClusterProvider = new TianYiContainerClusterProvider(this.getButler());
GeneralResult containerClusterList = tianYiContainerClusterProvider.list();
log.info("同步容器结果:{}",containerClusterList.isSuccess());
if (containerClusterList.isSuccess()) {
syncModel.setContainerClusterModels((List<ContainerClusterModel>) containerClusterList.getData());
List<ContainerClusterModel> containerClusterModels = (List<ContainerClusterModel>) containerClusterList.getData();
for (ContainerClusterModel clusterModel : containerClusterModels) {
// 同步容器节点信息
log.info("获取容器节点信息...");
TianYiContainerNodeProvider tianYiContainerNodeProvider = new TianYiContainerNodeProvider(this.getButler());
GeneralResult clusterNodeList = tianYiContainerNodeProvider.listNodes(clusterModel.getName());
log.info("同步容器节点结果:{}",clusterNodeList.isSuccess());
if (clusterNodeList.isSuccess()) {
clusterModel.setNodeModels((List<ContainerNodeModel>) clusterNodeList.getData());
}
// 同步容器节点池信息
log.info("获取容器节点池信息...");
GeneralResult clusterNodePoolList = tianYiContainerNodeProvider.listNodePools(clusterModel.getName());
log.info("同步容器节点池结果:{}",clusterNodePoolList.isSuccess());
if (clusterNodePoolList.isSuccess()) {
clusterModel.setNodePoolModels((List<ContainerNodePoolModel>) clusterNodePoolList.getData());
}
}
syncModel.setContainerClusterModels(containerClusterModels);
}
// 同步云硬盘