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

api, pdctl: add HTTP Component signature #4491

Merged
merged 16 commits into from
Dec 29, 2021

Conversation

CabinfeverB
Copy link
Member

@CabinfeverB CabinfeverB commented Dec 22, 2021

What problem does this PR solve?

close #4490 and related to #3111

This PR is going to support HTTP component signature

What is changed and how it works?

It adds a RoundTripper for adding a component signature header to every request and applies it to pdctl. (other components outside PD could add header by themselves)

For the test, this PR creates a test server and registers a temp handler for /pd/api/v1/health(just for test) and sends the request by health pdctl cmd.

Check List

Tests

  • Unit test

Release note

add HTTP Component signature

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
This reverts commit 9fef69a.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
This reverts commit dd14b0b.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
This reverts commit 810f1f5.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
This reverts commit 974deb5.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
This reverts commit 01fb757.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 22, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bufferflies
  • disksing

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 22, 2021
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB CabinfeverB changed the title api, pdctl: add Component signature api, pdctl: add HTTP Component signature Dec 23, 2021
pkg/apiutil/apiutil.go Outdated Show resolved Hide resolved
pkg/apiutil/apiutil.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 23, 2021
pkg/apiutil/apiutil.go Outdated Show resolved Hide resolved
pkg/apiutil/apiutil.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 27, 2021

Codecov Report

Merging #4491 (4c81e19) into master (909f2fd) will decrease coverage by 0.12%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4491      +/-   ##
==========================================
- Coverage   74.95%   74.83%   -0.13%     
==========================================
  Files         264      264              
  Lines       27921    27933      +12     
==========================================
- Hits        20929    20904      -25     
- Misses       5127     5158      +31     
- Partials     1865     1871       +6     
Flag Coverage Δ
unittests 74.83% <73.33%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tools/pd-ctl/pdctl/command/global.go 70.17% <0.00%> (+0.61%) ⬆️
pkg/apiutil/apiutil.go 65.38% <80.00%> (+3.47%) ⬆️
tests/pdctl/helper.go 100.00% <100.00%> (ø)
pkg/errs/errs.go 75.00% <0.00%> (-25.00%) ⬇️
server/kv/etcd_kv.go 69.56% <0.00%> (-10.15%) ⬇️
server/tso/local_allocator.go 64.86% <0.00%> (-6.76%) ⬇️
server/region_syncer/client.go 79.68% <0.00%> (-3.91%) ⬇️
server/tso/tso.go 60.22% <0.00%> (-1.71%) ⬇️
server/tso/allocator_manager.go 63.22% <0.00%> (-1.50%) ⬇️
server/server.go 71.49% <0.00%> (-1.35%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 909f2fd...4c81e19. Read the comment docs.

Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm. but ci failed.

pkg/apiutil/apiutil.go Outdated Show resolved Hide resolved
pkg/apiutil/apiutil.go Outdated Show resolved Hide resolved
@CabinfeverB CabinfeverB force-pushed the component_signature branch 4 times, most recently from b15265f to ed69b76 Compare December 28, 2021 08:24
CabinfeverB and others added 2 commits December 28, 2021 16:25
Co-authored-by: disksing <i@disksing.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Co-authored-by: disksing <i@disksing.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@CabinfeverB
Copy link
Member Author

/run-unit-test

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 28, 2021
@nolouch
Copy link
Contributor

nolouch commented Dec 29, 2021

/merge

@ti-chi-bot
Copy link
Member

@nolouch: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 34d403f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 29, 2021
@ti-chi-bot
Copy link
Member

@CabinfeverB: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add HTTP Component Signature
6 participants