-
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
Feature/remove public key after destroyed #910
Feature/remove public key after destroyed #910
Conversation
Codecov Report
@@ Coverage Diff @@
## master #910 +/- ##
==========================================
- Coverage 55.70% 54.81% -0.90%
==========================================
Files 263 263
Lines 19389 19427 +38
==========================================
- Hits 10800 10648 -152
- Misses 6875 7080 +205
+ Partials 1714 1699 -15
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
5c9d625
to
4d3b121
Compare
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.
And as we support deploying cluster with user specified SSH key (instead of generating new), so it would be better to check for duplicate during deploy process, and also not deleting the public key by default on scaling in and destroying.
components/cluster/command/prune.go
Outdated
@@ -73,7 +73,7 @@ func destroyTombstoneIfNeed(clusterName string, metadata *spec.ClusterMeta, opt | |||
return perrs.AddStack(err) | |||
} | |||
|
|||
nodes, err := operator.DestroyTombstone(ctx, topo, true /* returnNodesOnly */, opt, tlsCfg) | |||
nodes, err := operator.DestroyTombstone(ctx, topo, true /* returnNodesOnly */, opt, tlsCfg, ctx.PublicKeyPath) |
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.
ctx
is passed to DestroyTombstone()
so I don't think it's necessary to pass ctx.PublicKeyPath
again.
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 first argument inside DestoryTombestone()
is ExecutorGetter
interface:
tiup/pkg/cluster/operation/destroy.go
Lines 414 to 420 in cc41ad5
func DestroyTombstone( | |
getter ExecutorGetter, | |
cluster *spec.Specification, | |
returNodesOnly bool, | |
options Options, | |
tlsCfg *tls.Config, | |
) (nodes []string, err error) { |
task.Context
, but this results in import cycle
error. Please let me know if I've misssed something.
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 we can define another interface for the first param of DestroyTombstone
:
type SSHExecutorGetter interface {
ExecutorGetter
GetSSHKeySet() (string, string) // return both priv and public key
}
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.
@lucklove Or should we extend the original ExecutorGetter
interface with:
type ExecutorGetter interface {
Get(host string) (e executor.Executor)
GetSSHKeySet() (string, string)
}
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.
@lucklove I did it this way first, if you have any question, please let me know.
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.
@lucklove Or should we extend the original
ExecutorGetter
interface with:type ExecutorGetter interface { Get(host string) (e executor.Executor) GetSSHKeySet() (string, string) }
It's OK at this time. In the future there may be some executors that don't relay on ssh, at that time we can refactor this.
Seems test broken: |
4d3b121
to
bf61123
Compare
What's the status of this? It seems still using ctx.PublicKeyPath? https://github.com/pingcap/tiup/pull/910/files#diff-c2cb8d42eb23179c5056c3d5c626c7f2ddabad3db5171c8f869d59f75ddffc42R76 |
f7590f2
to
7c7cfea
Compare
@lucklove PTAL |
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.
Rest LGTM
/merge |
Can merge label has been added. Git tree hash: 8f82e4f
|
@9547: Your PR has out-of-dated and I have automatically updated it for you. 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 tidb-community-bots/ti-community-prow repository. |
What problem does this PR solve?
Try to implement #898
What is changed and how it works?
Check List
Tests
Code changes
Side effects
Related changes
Release notes: