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

Fix endpoint scheme detection for TLS origination to PD #977

Merged
merged 1 commit into from
Aug 11, 2021
Merged

Fix endpoint scheme detection for TLS origination to PD #977

merged 1 commit into from
Aug 11, 2021

Conversation

LINKIWI
Copy link
Contributor

@LINKIWI LINKIWI commented Aug 10, 2021

NormalizePDEndPoint is responsible for setting the URL scheme of the PD endpoint (ref). However, it's currently called before cfg.CoreConfig.ClusterTLSConfig is set, which causes Dashboard to make plaintext HTTP requests to PD all the time, regardless of whether --cluster-[ca|cert|key] flags are set.

This change fixes the TLS origination behavior by running this logic after cfg.CoreConfig.ClusterTLSConfig is (optionally) populated by buildTLSConfig. This allows Dashboard to properly use HTTPS to PD when cluster TLS is enabled.

I didn't find any existing unit tests to cover this change, but if there's a test I can add or update to cover this, I'm happy to include it in this PR.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 10, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • breeswish

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.

@bb7133
Copy link
Member

bb7133 commented Aug 11, 2021

Thanks for the contribution!

@bb7133
Copy link
Member

bb7133 commented Aug 11, 2021

The change looks reasonable. I've tried TLS configuration manually and it did fix the issue.

@ti-chi-bot
Copy link
Member

@bb7133: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

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.

@bb7133
Copy link
Member

bb7133 commented Aug 11, 2021

LGTM, but I'm not a reviewer :)

@bb7133
Copy link
Member

bb7133 commented Aug 11, 2021

PTAL @xhebox and @breeswish

Copy link

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @LINKIWI ! Changes LGTM.

For testing, it seems we must test the config logic as a whole since the order is significant. May with suggestion of @shhdgit & @breeswish we can push a follow up to add such test. I'd prefer avoid expanding a lot this PR since there is no test yet.

@ti-chi-bot
Copy link
Member

@tisonkun: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

Thanks for your contribution @LINKIWI ! Changes LGTM.

For testing, it seems we must test the config logic as a whole since the order is significant. May with suggestion of @shhdgit & @breeswish we can push a follow up to add such test. I'd prefer avoid expanding a lot this PR since there is no test yet.

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

@xhebox: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

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.

@shhdgit
Copy link
Member

shhdgit commented Aug 11, 2021

LGTM!

Sorry for the lack of tests. Additional tests on config initialization are welcome and may require some code restructuring. Improving test coverage is already in our roadmap.
Thanks again~

@breezewish
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 25e28e9

@ti-chi-bot ti-chi-bot merged commit c375b81 into pingcap:master Aug 11, 2021
shhdgit pushed a commit to shhdgit/tidb-dashboard that referenced this pull request Sep 2, 2021
shhdgit added a commit that referenced this pull request Sep 2, 2021
* feat(ui): add timezone information (#974)

* Fix endpoint scheme detection for TLS origination to PD (#977)

* build(deps): bump path-parse from 1.0.6 to 1.0.7 in /ui (#978)

Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump path-parse from 1.0.6 to 1.0.7 in /ui/tests (#981)

* Bump golangci to get the latest lints & fix lints (#984)

* Ci cherry pick version (#989)

* chore: add distro translation (#995)

* chore: add distro translation

* fix: lowercase

* update: release version

Co-authored-by: LINKIWI <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants