diff --git a/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/domain/model/ContainerClusterModel.java b/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/domain/model/ContainerClusterModel.java index 0bd9120d..7330ecb6 100644 --- a/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/domain/model/ContainerClusterModel.java +++ b/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/domain/model/ContainerClusterModel.java @@ -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 nodeModels; + private List nodePoolModels; } diff --git a/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/provider/common/TianyiLocationProvider.java b/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/provider/common/TianyiLocationProvider.java index bd8adb5f..c3e7d436 100644 --- a/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/provider/common/TianyiLocationProvider.java +++ b/bocloud.ctstack.plugin/src/main/java/com/bocloud/ctstack/plugin/provider/common/TianyiLocationProvider.java @@ -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) containerClusterList.getData()); + List containerClusterModels = (List) 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) clusterNodeList.getData()); + } + + // 同步容器节点池信息 + log.info("获取容器节点池信息..."); + GeneralResult clusterNodePoolList = tianYiContainerNodeProvider.listNodePools(clusterModel.getName()); + log.info("同步容器节点池结果:{}",clusterNodePoolList.isSuccess()); + if (clusterNodePoolList.isSuccess()) { + clusterModel.setNodePoolModels((List) clusterNodePoolList.getData()); + } + } + syncModel.setContainerClusterModels(containerClusterModels); } // 同步云硬盘