From 49d36d1dd97c08a042793868d5b4853beafdd12b Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Mon, 22 Apr 2024 20:59:16 +0800 Subject: [PATCH] =?UTF-8?q?job=20=E8=B0=83=E7=94=A8=20cmdb=20list=5Fkube?= =?UTF-8?q?=5Fworkload=20api=20=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E5=AF=BC=E8=87=B4=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=20#2924?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cc/model/container/KubeWorkloadDTO.java | 2 +- .../bk/job/common/cc/sdk/BizCmdbClient.java | 25 ++++++++----------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/model/container/KubeWorkloadDTO.java b/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/model/container/KubeWorkloadDTO.java index 4bb27997a6..e9ffafdda4 100644 --- a/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/model/container/KubeWorkloadDTO.java +++ b/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/model/container/KubeWorkloadDTO.java @@ -63,7 +63,7 @@ public interface Fields { private Long bizId; /** - * namespace 资源 ID(namespace 在 cmdb 中注册资源的 ID) + * workload 资源 ID(wordload 在 cmdb 中注册资源的 ID) */ private Long id; diff --git a/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/sdk/BizCmdbClient.java b/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/sdk/BizCmdbClient.java index b759f92d9d..6ea7177ba0 100644 --- a/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/sdk/BizCmdbClient.java +++ b/src/backend/commons/cmdb-sdk/src/main/java/com/tencent/bk/job/common/cc/sdk/BizCmdbClient.java @@ -1701,7 +1701,7 @@ private ListKubeClusterReq buildNextPageListKubeClusterReq(ListKubeClusterReq or ListKubeClusterReq nextPageReq = new ListKubeClusterReq(); nextPageReq.setPage(originReq.getPage()); nextPageReq.setBizId(originReq.getBizId()); - originReq.setFields(originReq.getFields()); + nextPageReq.setFields(originReq.getFields()); nextPageReq.setBkSupplierAccount(originReq.getBkSupplierAccount()); // 添加 cluster ID 作为分页查询 offset 条件 @@ -1790,7 +1790,7 @@ private ListKubeNamespaceReq buildNextPageListKubeNamespaceReq(ListKubeNamespace ListKubeNamespaceReq nextPageReq = new ListKubeNamespaceReq(); nextPageReq.setPage(originReq.getPage()); nextPageReq.setBizId(originReq.getBizId()); - originReq.setFields(originReq.getFields()); + nextPageReq.setFields(originReq.getFields()); nextPageReq.setBkSupplierAccount(originReq.getBkSupplierAccount()); // 添加 namespace ID 作为分页查询 offset 条件 @@ -1845,18 +1845,15 @@ public List listKubeWorkloads(WorkloadQuery query) { return buildNextPageListKubeWorkloadReq(req, latestElement.getId()); } }, - pageReq -> listPage( - req, - false, - cmdbPageReq -> requestCmdbApi( - ApiGwType.BK_APIGW, - HttpMethodEnum.POST, - requestUrl, - null, - cmdbPageReq, - new TypeReference>>() { - })), - PageData::getData, + cmdbPageReq -> requestCmdbApi( + ApiGwType.BK_APIGW, + HttpMethodEnum.POST, + requestUrl, + null, + cmdbPageReq, + new TypeReference>>() { + }), + resp -> resp.getData().getInfo(), workload -> { // cmdb API 返回的数据没有包含 kind 信息,需要补全 workload.setKind(req.getKind());