-
Notifications
You must be signed in to change notification settings - Fork 312
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
cluster: support enable or disable TLS for an exiting cluster #1657
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. |
Codecov Report
@@ Coverage Diff @@
## master #1657 +/- ##
==========================================
- Coverage 48.22% 47.31% -0.91%
==========================================
Files 298 298
Lines 33496 34137 +641
==========================================
Hits 16151 16151
- Misses 15258 15899 +641
Partials 2087 2087
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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 did some manual tests and seems all functions are working.
// if force is true, skip this check | ||
if globalOptions.TLSEnabled == enable && !gOpt.Force { | ||
if enable { | ||
m.logger.Infof("cluster `%s` TLS status is already enable\n", name) |
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.
m.logger.Infof("cluster `%s` TLS status is already enable\n", name) | |
m.logger.Infof("cluster `%s` TLS status is already enabled\n", name) |
if enable { | ||
m.logger.Infof("cluster `%s` TLS status is already enable\n", name) | ||
} else { | ||
m.logger.Infof("cluster `%s` TLS status is already disable\n", name) |
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.
m.logger.Infof("cluster `%s` TLS status is already disable\n", name) | |
m.logger.Infof("cluster `%s` TLS status is already disabled\n", name) |
} | ||
|
||
if enable { | ||
m.logger.Infof("Enable cluster `%s` TLS between TiDB components successfully", name) |
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.
m.logger.Infof("Enable cluster `%s` TLS between TiDB components successfully", name) | |
m.logger.Infof("Enabled TLS between TiDB components for cluster `%s` successfully", name) |
if enable { | ||
m.logger.Infof("Enable cluster `%s` TLS between TiDB components successfully", name) | ||
} else { | ||
m.logger.Infof("Disable cluster `%s` TLS between TiDB components successfully", name) |
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.
m.logger.Infof("Disable cluster `%s` TLS between TiDB components successfully", name) | |
m.logger.Infof("Disabled TLS between TiDB components for cluster `%s` successfully", name) |
} | ||
|
||
if len(clusterSpec.PDServers) != 1 { | ||
return errorx.EnsureStackTrace(fmt.Errorf("Multiple PD nodes is not supported enable/disable TLS")). |
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.
return errorx.EnsureStackTrace(fmt.Errorf("Multiple PD nodes is not supported enable/disable TLS")). | |
return errorx.EnsureStackTrace(fmt.Errorf("Having multiple PD nodes is not supported when enable/disable TLS")). |
if !skipConfirm { | ||
return tui.PromptForConfirmOrAbortError( | ||
fmt.Sprintf("Enable/Disable TLS will %s the cluster `%s`\nDo you want to continue? [y/N]:", | ||
color.HiYellowString("restart"), |
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.
color.HiYellowString("restart"), | |
color.HiYellowString("stop and restart"), |
It would be better if we make it clear that the cluster will be unavailable during the process.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 1ec1562
|
What problem does this PR solve?
close #1598
Only supports single PD node cluster
What is changed and how it works?
add a new tiup-cluster sub cmd
Check List
Tests
It is best to run tpcc during the manual test
enable
./tiup-cluster tls cluster-name enable --reload-certificate ./tiup-cluster display cluster-name ./tiup-cluster scale-out cluster-name scale-out.yaml
disable
Code changes
Side effects
Related changes
Release notes: