-
Notifications
You must be signed in to change notification settings - Fork 720
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
mcs: make scheduling server support operator http interface #7090
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Skipping CI for Draft Pull Request. |
Signed-off-by: lhy1024 <admin@liudos.us>
cfa1860
to
c4c9359
Compare
Signed-off-by: lhy1024 <admin@liudos.us>
bc94273
to
9aa69f1
Compare
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Codecov Report
@@ Coverage Diff @@
## master #7090 +/- ##
==========================================
+ Coverage 74.26% 74.62% +0.35%
==========================================
Files 441 441
Lines 47216 47282 +66
==========================================
+ Hits 35064 35283 +219
+ Misses 9063 8913 -150
+ Partials 3089 3086 -3
Flags with carried forward coverage won't be shown. Click here to find out more. |
// @Produce json | ||
// @Success 200 {object} []operator.OpRecord | ||
// @Failure 400 {string} string "The request is invalid." | ||
// @Failure 500 {string} string "PD server failed to proceed the request." |
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.
Do we have it here?
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.
It is a copy from server/api, maybe we need to fix all other comments too.
pkg/mcs/scheduling/server/server.go
Outdated
@@ -469,6 +469,12 @@ func (s *Server) startWatcher() (err error) { | |||
return err | |||
} | |||
|
|||
// GetOpts returns the persist config. | |||
// It's used to test. | |||
func (s *Server) GetOpts() *config.PersistConfig { |
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.
How about using getcluster?
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.
It has not SetPlacementRuleEnabled
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.
Maybe you can add it?
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.
I will add it in another pr about refactor cluster
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.
Or rename it to GetPersistConfig
// ParseTime parses a time string with the format "1694580288" | ||
func ParseTime(t string) (time.Time, error) { | ||
if len(t) == 0 { | ||
return time.Time{}, nil |
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.
Do we need to return an error?
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.
No, for http api if there is no "from", it will return all results. I added a comment about it.
@@ -132,10 +132,21 @@ func (suite *apiTestSuite) TestAPIForward() { | |||
re.NoError(err) | |||
re.Len(slice, 0) | |||
|
|||
err = testutil.ReadGetJSON(re, testDialClient, fmt.Sprintf("%s/%s", urlPrefix, "operators/2"), &resp, | |||
testutil.WithHeader(re, apiutil.ForwardToMicroServiceHeader, "true")) | |||
err = testutil.CheckPostJSON(testDialClient, fmt.Sprintf("%s/%s", urlPrefix, "operators"), []byte(``), |
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.
Do we need to add a successful get test?
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.
This test only tests forward. And a successful get test will be tested in tests/server/api
and tests/pdctl
.
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.
Why not also add it here?
Signed-off-by: lhy1024 <admin@liudos.us>
from time.Time | ||
err error | ||
) | ||
if froms := r.URL.Query()["from"]; len(froms) > 0 { |
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.
Do we need to maintain this interface?
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.
I am not sure, this pr only keep the same with pd mode.
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.
The rest LGTM
pkg/schedule/handler/handler.go
Outdated
default: | ||
return http.StatusBadRequest, nil, errors.Errorf("unknown operator") | ||
} | ||
return http.StatusOK, nil, errors.Errorf("The operator is created.") |
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.
Does return error here make sense?
c.IndentedJSON(http.StatusOK, records) | ||
} | ||
|
||
// FIXME: details of input json body params |
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.
What does this mean? 👀
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.
only copy from previous code
Signed-off-by: lhy1024 <admin@liudos.us>
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.
LGTM!
/merge |
@lhy1024: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 5e4559f
|
@lhy1024: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
ref tikv#5839 Signed-off-by: lhy1024 <admin@liudos.us> Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
What problem does this PR solve?
Issue Number: Ref #5839
What is changed and how does it work?
It can be reviewed after #7113 and #7120
Check List
Tests
Release note