Skip to content
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

refactor: provide API for change plugin motion status synchronously #4745

Merged
merged 3 commits into from
Oct 23, 2023

Conversation

guqing
Copy link
Member

@guqing guqing commented Oct 18, 2023

What type of PR is this?

/kind improvement
/area core
/area console

What this PR does / why we need it:

提供允许同步更改插件运行状态的 API

Which issue(s) this PR fixes:

Fixes #4744

Does this PR introduce a user-facing change?

提供允许同步更改插件运行状态的 API

@f2c-ci-robot f2c-ci-robot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/improvement Categorizes issue or PR as related to a improvement. area/core Issues or PRs related to the Halo Core area/console Issues or PRs related to the Halo Console labels Oct 18, 2023
@guqing guqing changed the title [WIP] refactor: provide APIs for change plugin motion status synchronously [WIP] refactor: provide API for change plugin motion status synchronously Oct 18, 2023
@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Merging #4745 (754954e) into main (21e975d) will decrease coverage by 0.08%.
The diff coverage is 37.77%.

@@             Coverage Diff              @@
##               main    #4745      +/-   ##
============================================
- Coverage     61.58%   61.50%   -0.08%     
- Complexity     2797     2798       +1     
============================================
  Files           403      403              
  Lines         14725    14770      +45     
  Branches       1023     1028       +5     
============================================
+ Hits           9068     9085      +17     
- Misses         5165     5193      +28     
  Partials        492      492              
Files Coverage Δ
...lo/app/core/extension/endpoint/PluginEndpoint.java 64.60% <37.77%> (-2.85%) ⬇️

@guqing guqing changed the title [WIP] refactor: provide API for change plugin motion status synchronously refactor: provide API for change plugin motion status synchronously Oct 18, 2023
@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 18, 2023
@guqing
Copy link
Member Author

guqing commented Oct 18, 2023

ready for review

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@halo-dev/sig-halo

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Oct 19, 2023
@ruibaby ruibaby added this to the 2.11.x milestone Oct 19, 2023
private ExpectedAction action;
private boolean async;

enum ExpectedAction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不建议在这里制造一种新概念。整个系统尽量保持一种风格。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没懂 保持一种风格指的是保持什么

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参数为 boolean 值?

@@ -201,6 +203,27 @@ public RouterFunction<ServerResponse> endpoint() {
.response(responseBuilder()
.implementation(Plugin.class))
)
.PUT("plugins/{name}/motion-status", this::changeMotionStatus,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里似乎不是一个常规的资源型请求 - PUT resources

得确认一下分配插件管理权限后是否能正常调用。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以的 ,与 PUT plugins/{name}/reload 一样,权限正确

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@guqing guqing Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考:

PUT /api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers
PUT /api/v1/namespaces/{namespace}/pods/{name}/proxy

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#replace-ephemeralcontainers-pod-v1-core
kubernetes 的 api-conventions 中也没有关于 PUT 子资源的描述 https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#verbs-on-resources,但是他们是这么做的

那么对于这种更新部分字段操作的自定义 API 不用 PUT 用什么呢

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接对子资源的某些字段进行 PUT 操作似乎也是合理的。建议我们先完善一下 RFC。

@f2c-ci-robot f2c-ci-robot bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2023
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2023
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 23, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2023
@f2c-ci-robot f2c-ci-robot bot merged commit 772c7fc into halo-dev:main Oct 23, 2023
2 checks passed
@guqing guqing deleted the refactor/4744 branch October 23, 2023 03:19
f2c-ci-robot bot pushed a commit that referenced this pull request Oct 26, 2023
#### What type of PR is this?

/area console
/kind improvement

#### What this PR does / why we need it:

适配 #4745 ,使用新的接口启动/停止插件。

#### Which issue(s) this PR fixes:

Fixes #4744 

#### Special notes for your reviewer:


#### Does this PR introduce a user-facing change?

```release-note
None
```
@JohnNiang JohnNiang modified the milestones: 2.11.x, 2.11.0 Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/console Issues or PRs related to the Halo Console area/core Issues or PRs related to the Halo Core kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

希望后端提供插件启动和停止的 APIs 以简化前端启动插件的复杂度
3 participants