forked from TencentBlueKing/bk-job
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Job 支持容器执行 - 脚本任务 TencentBlueKing#2631
- Loading branch information
Showing
36 changed files
with
723 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
168 changes: 168 additions & 0 deletions
168
.../api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebContainerResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. | ||
* | ||
* License for BK-JOB蓝鲸智云作业平台: | ||
* -------------------------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bk.job.manage.api.web; | ||
|
||
import com.tencent.bk.job.common.annotation.WebAPI; | ||
import com.tencent.bk.job.common.model.PageData; | ||
import com.tencent.bk.job.common.model.Response; | ||
import com.tencent.bk.job.common.model.dto.AppResourceScope; | ||
import com.tencent.bk.job.manage.model.web.request.chooser.ListTopologyTreesReq; | ||
import com.tencent.bk.job.manage.model.web.request.chooser.container.ContainerCheckReq; | ||
import com.tencent.bk.job.manage.model.web.request.chooser.container.ContainerDetailReq; | ||
import com.tencent.bk.job.manage.model.web.request.chooser.container.ContainerIdWithMeta; | ||
import com.tencent.bk.job.manage.model.web.request.chooser.container.ListContainerByTopologyNodesReq; | ||
import com.tencent.bk.job.manage.model.web.vo.chooser.container.ContainerTopologyNodeVO; | ||
import com.tencent.bk.job.manage.model.web.vo.chooser.container.ContainerVO; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import io.swagger.annotations.ApiParam; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestAttribute; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import springfox.documentation.annotations.ApiIgnore; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 容器管理 WEB API | ||
*/ | ||
@Api(tags = {"job-manage", "web", "container_management"}) | ||
@RequestMapping("/web") | ||
@RestController | ||
@WebAPI | ||
public interface WebContainerResource { | ||
|
||
// 容器选择器标准接口-1 | ||
@ApiOperation(value = "获取容器拓扑树(含各节点容器数)", produces = "application/json") | ||
@PostMapping(value = {"/scope/{scopeType}/{scopeId}/topology/container"}) | ||
Response<List<ContainerTopologyNodeVO>> listTopologyTrees( | ||
@ApiParam("用户名,网关自动传入") | ||
@RequestHeader("username") | ||
String username, | ||
@ApiIgnore | ||
@RequestAttribute(value = "appResourceScope") | ||
AppResourceScope appResourceScope, | ||
@ApiParam(value = "资源范围类型", required = true) | ||
@PathVariable(value = "scopeType") | ||
String scopeType, | ||
@ApiParam(value = "资源范围ID", required = true) | ||
@PathVariable(value = "scopeId") | ||
String scopeId, | ||
@ApiParam(value = "资源范围信息") | ||
@RequestBody(required = false) | ||
ListTopologyTreesReq req | ||
); | ||
|
||
// 容器选择器标准接口-2 | ||
@ApiOperation(value = "容器选择器根据拓扑节点集合获取容器列表", produces = "application/json") | ||
@PostMapping(value = {"/scope/{scopeType}/{scopeId}/topology/containers/nodes"}) | ||
Response<PageData<ContainerVO>> listContainerByTopologyNodes( | ||
@ApiParam("用户名,网关自动传入") | ||
@RequestHeader("username") | ||
String username, | ||
@ApiIgnore | ||
@RequestAttribute(value = "appResourceScope") | ||
AppResourceScope appResourceScope, | ||
@ApiParam(value = "资源范围类型", required = true) | ||
@PathVariable(value = "scopeType") | ||
String scopeType, | ||
@ApiParam(value = "资源范围ID", required = true) | ||
@PathVariable(value = "scopeId") | ||
String scopeId, | ||
@ApiParam(value = "拓扑节点集合与分页信息", required = true) | ||
@RequestBody | ||
ListContainerByTopologyNodesReq req | ||
); | ||
|
||
// 容器选择器标准接口-3 | ||
@ApiOperation(value = "容器选择器根据拓扑节点集合获取容器资源ID列表,用于跨页全选容器功能" | ||
, produces = "application/json") | ||
@PostMapping(value = {"/scope/{scopeType}/{scopeId}/topology/containerIds/nodes"}) | ||
Response<PageData<ContainerIdWithMeta>> listContainerIdByTopologyNodes( | ||
@ApiParam("用户名,网关自动传入") | ||
@RequestHeader("username") | ||
String username, | ||
@ApiIgnore | ||
@RequestAttribute(value = "appResourceScope") | ||
AppResourceScope appResourceScope, | ||
@ApiParam(value = "资源范围类型", required = true) | ||
@PathVariable(value = "scopeType") | ||
String scopeType, | ||
@ApiParam(value = "资源范围ID", required = true) | ||
@PathVariable(value = "scopeId") | ||
String scopeId, | ||
@ApiParam(value = "拓扑节点集合与分页信息", required = true) | ||
@RequestBody | ||
ListContainerByTopologyNodesReq req | ||
); | ||
|
||
|
||
// 容器选择器标准接口-4 | ||
@ApiOperation(value = "根据用户选择/输入的容器信息获取容器") | ||
@PostMapping(value = {"/scope/{scopeType}/{scopeId}/container/check"}) | ||
Response<List<ContainerVO>> checkContainers( | ||
@ApiParam("用户名,网关自动传入") | ||
@RequestHeader("username") | ||
String username, | ||
@ApiIgnore | ||
@RequestAttribute(value = "appResourceScope") | ||
AppResourceScope appResourceScope, | ||
@ApiParam(value = "资源范围类型", required = true) | ||
@PathVariable(value = "scopeType") | ||
String scopeType, | ||
@ApiParam(value = "资源范围ID", required = true) | ||
@PathVariable(value = "scopeId") | ||
String scopeId, | ||
@ApiParam(value = "用户选择/输入的容器信息", required = true) | ||
@RequestBody | ||
ContainerCheckReq req | ||
); | ||
|
||
// 容器选择器标准接口-5 | ||
@ApiOperation(value = "根据容器资源 ID批量查询容器详情信息") | ||
@PostMapping(value = {"/scope/{scopeType}/{scopeId}/containers/details"}) | ||
Response<List<ContainerVO>> getContainerDetails( | ||
@ApiParam("用户名,网关自动传入") | ||
@RequestHeader("username") | ||
String username, | ||
@ApiIgnore | ||
@RequestAttribute(value = "appResourceScope") | ||
AppResourceScope appResourceScope, | ||
@ApiParam(value = "资源范围类型", required = true) | ||
@PathVariable(value = "scopeType") | ||
String scopeType, | ||
@ApiParam(value = "资源范围ID", required = true) | ||
@PathVariable(value = "scopeId") | ||
String scopeId, | ||
@ApiParam(value = "容器ID及元数据信息", required = true) | ||
@RequestBody | ||
ContainerDetailReq req | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...java/com/tencent/bk/job/manage/model/web/request/chooser/container/ContainerCheckReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. | ||
* | ||
* License for BK-JOB蓝鲸智云作业平台: | ||
* -------------------------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bk.job.manage.model.web.request.chooser.container; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Data | ||
@ApiModel("容器检查请求报文") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ContainerCheckReq { | ||
|
||
@ApiModelProperty(value = "容器Uid列表", required = true) | ||
private List<String> containerUidList = new ArrayList<>(); | ||
|
||
} | ||
|
||
|
43 changes: 43 additions & 0 deletions
43
...ava/com/tencent/bk/job/manage/model/web/request/chooser/container/ContainerDetailReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. | ||
* | ||
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. | ||
* | ||
* License for BK-JOB蓝鲸智云作业平台: | ||
* -------------------------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and | ||
* to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | ||
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bk.job.manage.model.web.request.chooser.container; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Data | ||
@ApiModel("容器详情请求报文") | ||
public class ContainerDetailReq { | ||
|
||
@ApiModelProperty(value = "containerId及元数据列表", required = true) | ||
List<ContainerIdWithMeta> containerList = new ArrayList<>(); | ||
|
||
} | ||
|
||
|
Oops, something went wrong.