-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: 提供 Agent 包管理后台接口 (closed #1683) #1844
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## v2.4.4-dev #1844 +/- ##
==============================================
- Coverage 74.71% 74.70% -0.01%
==============================================
Files 404 411 +7
Lines 28246 28698 +452
==============================================
+ Hits 21103 21439 +336
- Misses 7143 7259 +116 ☔ View full report in Codecov by Sentry. |
781da34
to
26bc8ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整体上有几个问题:
- 请求参数不完善,没有相关的字段描述
- 接口注释不完善,不知道哪个接口用在哪个页面,对应关系要补充
- swagger_auto_schema 引入目的是?尽可能整个项目用一套
|
||
filter_fields = ("module", "creator", "is_ready", "version") | ||
|
||
@swagger_auto_schema( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么不用原生的 swagger_auto_schema
?
] | ||
|
||
mock_os_cpu_arch = [ | ||
{"name": "Linux_x86_64", "id": "linux_x86_64", "host_count": 10}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operation_summary="获取快速筛选信息", | ||
tags=PACKAGE_MANAGE_VIEW_TAGS, | ||
) | ||
@action(detail=False, methods=["GET"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少参数
agent
orproxy
"packages": [ | ||
{ | ||
"pkg_abs_path": "xxx/xxxxx", | ||
"pkg_name": "gseagent_2.1.7_linux_x86_64.tgz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
设计稿的包名称有点问题,这里的 mock 数据按我们真实的来:gse_agent-v2.1.3-beta.18.tgz
from apps.node_man.models import AgentPackages | ||
|
||
|
||
class AgentPackageSerializer(serializers.ModelSerializer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
序列化器的字段描述要再完善下, review 理解起来有点难
"tags": [{"id": "stable", "name": "稳定版本"}], | ||
"creator": "string", | ||
"pkg_ctime": "2019-08-24 14:15:22", | ||
"host_count": 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
host_count
属于耗时查询,需要和列表拉取逻辑解耦,单独设计出按 pkg_ids
拉取部署数量的接口
@swagger_auto_schema( | ||
operation_summary="操作类动作:启用/停用", | ||
body_in=pkg_manage.OperateSerializer, | ||
responses={200: pkg_manage.SearchResponseSerializer}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么 update 是返回 SearchResponseSerializer
?
# ordering_fields = ("module",) | ||
serializer_class = pkg_manage.PackageSerializer | ||
filter_backends = (DjangoFilterBackend, filters.SearchFilter, filters.OrderingFilter) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺 PermissionClass,这个 PermissionClass 可以限制目前仅限超管访问
|
||
class SearchSerializer(serializers.Serializer): | ||
os_cpu_arch = serializers.CharField(required=False) | ||
tags = serializers.ListField(required=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
复用 filterset_fields
实现基础的筛选,参考:
- GSEKit:https://github.com/TencentBlueKing/bk-process-config-manager/blob/V1.0.X/apps/gsekit/job/views.py
- 扩展 DjangoFilterBackend,实现额外字段(例如 tag)的筛选。
26bc8ca
to
6aa02ca
Compare
6964d08
to
9b1ea46
Compare
2ca9717
to
1b0d11c
Compare
1b0d11c
to
038f301
Compare
038f301
to
9529982
Compare
PR
CheckList(PR Assigners)
确认已完成以下操作:
backlog
->todo
->for test
->tested(需通过测试同学测试)
->done
pr/reviewable
CheckList(PR Reviewers)
确认已完成以下操作:
pr/reviewable
,要求重新修改