Skip to content

Commit

Permalink
job 调用 cmdb list_kube_workload api 查询条件不正确导致循环查询 TencentBlueKing#2924
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Apr 22, 2024
1 parent 90f4aef commit 49d36d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public interface Fields {
private Long bizId;

/**
* namespace 资源 ID(namespace 在 cmdb 中注册资源的 ID)
* workload 资源 ID(wordload 在 cmdb 中注册资源的 ID)
*/
private Long id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 条件
Expand Down Expand Up @@ -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 条件
Expand Down Expand Up @@ -1845,18 +1845,15 @@ public List<KubeWorkloadDTO> listKubeWorkloads(WorkloadQuery query) {
return buildNextPageListKubeWorkloadReq(req, latestElement.getId());
}
},
pageReq -> listPage(
req,
false,
cmdbPageReq -> requestCmdbApi(
ApiGwType.BK_APIGW,
HttpMethodEnum.POST,
requestUrl,
null,
cmdbPageReq,
new TypeReference<EsbResp<BaseCcSearchResult<KubeWorkloadDTO>>>() {
})),
PageData::getData,
cmdbPageReq -> requestCmdbApi(
ApiGwType.BK_APIGW,
HttpMethodEnum.POST,
requestUrl,
null,
cmdbPageReq,
new TypeReference<EsbResp<BaseCcSearchResult<KubeWorkloadDTO>>>() {
}),
resp -> resp.getData().getInfo(),
workload -> {
// cmdb API 返回的数据没有包含 kind 信息,需要补全
workload.setKind(req.getKind());
Expand Down

0 comments on commit 49d36d1

Please sign in to comment.