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

openapi(dm): add openapi conifg in dm-master config file #3836

Merged
merged 10 commits into from
Dec 30, 2021
Merged

openapi(dm): add openapi conifg in dm-master config file #3836

merged 10 commits into from
Dec 30, 2021

Conversation

Ehco1996
Copy link
Contributor

@Ehco1996 Ehco1996 commented Dec 10, 2021

What problem does this PR solve?

Issue Number: ref #3583

What is changed and how it works?

  • add new config part openapi for dm-master, default value is false
  • depreated openapi in experimental config

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to update the documentation

Release note

`turn on the openapi for DM by default`.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 10, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • okJiang

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 release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 10, 2021
@Ehco1996 Ehco1996 mentioned this pull request Dec 10, 2021
14 tasks
@Ehco1996
Copy link
Contributor Author

/run-dm-integration-tests

@lance6716
Copy link
Contributor

not sure we plan to turn on it by default or remove it from experimental features.

@Ehco1996
Copy link
Contributor Author

not sure we plan to turn on it by default or remove it from experimental features.

ptal @sunzhaoyang

@lance6716 lance6716 added the area/dm Issues or PRs related to DM. label Dec 13, 2021
@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 15, 2021
@sunzhaoyang
Copy link

not sure we plan to turn on it by default or remove it from experimental features.

ptal @sunzhaoyang

I prefer to remove from experimental features and turn off by default (for security), if dmctl depend on openapi in the future, perhaps it should be implemented with api authentication. @Ehco1996 @lance6716

@ljun0712
Copy link

基于安全考虑,没有认证鉴权的openapi默认不要打开,后续实现了api的认证鉴权后再打开会比较合适

@Ehco1996
Copy link
Contributor Author

not sure we plan to turn on it by default or remove it from experimental features.

ptal @sunzhaoyang

I prefer to remove from experimental features and turn off by default (for security), if dmctl depend on openapi in the future, perhaps it should be implemented with api authentication. @Ehco1996 @lance6716

so we need add a new config like openapi=true in dm-master's conig file ?

@sunzhaoyang
Copy link

Again, I considered the necessity and safety.
It might be better to keep the configuration item under [experimental] and default openapi = false, maybe we can change it to default true when the authentication is implemented.

@lance6716 Any better advice?

@Ehco1996
Copy link
Contributor Author

/hold

we are waiting for tidb to come up with a solution to the security issue.

@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 21, 2021
@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 28, 2021
@Ehco1996
Copy link
Contributor Author

/unhold

update final solution in PR description

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 28, 2021
@Ehco1996
Copy link
Contributor Author

/run-dm-integration-tests

@Ehco1996 Ehco1996 changed the title openapi(dm): turn on the openapi for DM by default openapi(dm): add openapi conifg in dm-master config file Dec 28, 2021
@Ehco1996
Copy link
Contributor Author

/run-dm-integration-tests

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 28, 2021
@@ -313,6 +314,10 @@ func (c *Config) adjust() error {
c.QuotaBackendBytes = quotaBackendBytesLowerBound
}

if c.ExperimentalFeatures.OpenAPI {
log.L().Warn("openapi is a GA feature and removed from experimental features, so this configuration will have no affect, please set openapi=true in dm-master config file")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should enable OpenAPI if it is upgraded from an old cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but how should i do this in code ? do i need to update dm-master's config file for user ? 🙄


or what if user set

openapi = false

[experimental]
openapi = true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is the expected heavior when enable openapi in v5.3 but forget to add new added config in dm-master after upgrade ? @sunzhaoyang ptal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

after talked with pm, both cfg.OpenAPI and s.cfg.ExperimentalFeatures.OpenAPI will take effects when user want to enable openapi, added in 4c20104

ptal @GMHDBJD

Choose a reason for hiding this comment

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

what is the expected heavior when enable openapi in v5.3 but forget to add new added config in dm-master after upgrade ? @sunzhaoyang ptal

Disabled. He has to enable manually.

@@ -20,6 +20,7 @@ max-request-bytes = 1572864
auto-compaction-mode = "periodic"
auto-compaction-retention = "1h"
quota-backend-bytes = 2147483648
openapi = false
Copy link
Contributor

@GMHDBJD GMHDBJD Dec 28, 2021

Choose a reason for hiding this comment

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

Can we omit the below lines when by get-config at L29? looks so confused.

[experimental]
  openapi = false

@Ehco1996 Ehco1996 added this to the v5.4.0 milestone Dec 28, 2021
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 28, 2021
@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 28, 2021
@@ -128,6 +128,7 @@ type Config struct {
AutoCompactionMode string `toml:"auto-compaction-mode" json:"auto-compaction-mode"`
AutoCompactionRetention string `toml:"auto-compaction-retention" json:"auto-compaction-retention"`
QuotaBackendBytes int64 `toml:"quota-backend-bytes" json:"quota-backend-bytes"`
OpenAPI bool `toml:"openapi"`
Copy link
Contributor

Choose a reason for hiding this comment

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

json?

@@ -91,7 +91,7 @@ func NewConfig() *Config {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

--openapi for command line config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now i think config file is enough becasue we will enable OpenAPI as default in the feature

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok added in 0463672

v1-sources-path = ""
ssl-ca = ""
ssl-cert = ""
ssl-key = ""

[experimental]
openapi = false
Copy link
Contributor

Choose a reason for hiding this comment

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

if experimental.openapi==true, still print it? Why not set it to false when adjust?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes we should adjust this value , added in 0964771

@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 28, 2021
Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

rest LGTM

Comment on lines 48 to 50
# some experimental features
[experimental]
openapi = false
Copy link
Contributor

Choose a reason for hiding this comment

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

This file used for --print-sample-config, so I prefer to remove these lines.

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

@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 30, 2021
@Ehco1996
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: b469dbf

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

@Ehco1996: 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.

@Ehco1996
Copy link
Contributor Author

/run-leak-test
/run-verify

@ti-chi-bot ti-chi-bot merged commit 1d376cd into pingcap:master Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dm Issues or PRs related to DM. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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.

8 participants