-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
kubeadm: fixed etcd sync endpoints #71945
Conversation
Hi @pytimer. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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 kubernetes/test-infra repository. |
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.
Well spotted @pytimer ! Thank you!
Can you also create cherry-pick PR for 1.13 once this one merges?
/lgtm
/ok-to-test
/kind bug
/assign @fabriziopandini
/assign @neolit123
/priority important-soon |
/test pull-kubernetes-e2e-gce-100-performance |
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.
@pytimer
thanks, added a comment about pointers vs non-pointers.
|
||
return etcdClient, nil | ||
} | ||
|
||
// Sync synchronizes client's endpoints with the known endpoints from the etcd membership. | ||
func (c Client) Sync() error { | ||
func (c *Client) Sync() error { | ||
cli, err := clientv3.New(clientv3.Config{ |
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.
having a single method that accepts a pointer and the rest accepting non-pointers seems a bit odd.
we might want to make all of them accept pointer... see GetVersion(), GetClusterVersions() etc.
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.
you mean that Sync() return the real etcd endpoints? such as:
func (c Client) Sync() ([]string, error) {}
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 methods for Client
have different signatures:
func (c *Client) Sync()
func (c Client) AddMember(name string, peerAddrs string) ([]Member, error) {
...
Sync()
uses a pointer, but the rest of the methods use non-pointers.
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.
Sync() only return error now, but the rest of the methods return multi values.
Can change this Sync()
method return endpoints and error, like other methods?
The NewFromCluster
invoke Sync()
like below:
endpoints, err = etcdClient.Sync()
if err != nil {
return nil, errors.Wrap(err, "error syncing endpoints with etc")
}
etcdClient.Endpoints = endpoints
In this case, all methods use non-pointers, and only change Sync()
methods, but test case maybe need to update.
The other ways, the methods of Client
all change non-pointers to pointer, the way need to change more codes.
I am not sure if i understand what you mean?If wrong, can you explain your comments again. Thanks.
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.
@pytimer my point is this:
func (c *Client) Sync(...) ...
func (c Client) AddMember(...) ...
...
^ see how c
is a pointer in Sync
but not a pointer in the rest of methods for the Client
type.
we need to make all the methods consistent.
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.
/hold
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.
@pytimer please kindly fix as discussed above to address @neolit123 feedback and then I will leave hold
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.
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.
@pytimer @fabriziopandini @neolit123 I am not OK with func (c Client) Sync() ([]string, error)
. This is no longer a Sync
method. It's not even a GetEndpoints
method (because we have Endpoints
member in Client
). Furthermore, this introduces a code smell (inappropriate intimacy), where NewFromCluster
now updates field inside Client
.
This is a lot worse solution to the problem it tries to solve. I am much more in favor of making all methods func (c *Client)
, than have this. I am also in favor of having only Sync()
take a pointer to Client
.
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.
@pytimer
OK, i missed the part that we want to modify the existing Client object and not a copy.
please bring back (c *Client) Sync()
.
we will then cherry pick this PR for 1.13.
and we can have another PR that refactors all methods to use pointers.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: neolit123, pytimer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks for you reply. I understand your said. If my tone looks a little impatient, sorry.I am willing to patiently wait for the way of the better solution. If have the best solution about it, I will implement it. But maybe time zone different from yours, comments can not reply immediately. |
@pytimer please also make the release note in the OP: thanks. |
ca1fdbc
to
48d757b
Compare
@neolit123 @fabriziopandini @rosti I bring back Please let me know if i need to do other things. thanks. |
@pytimer |
/test pull-kubernetes-e2e-gce-100-performance |
@pytimer thanks! |
@pytimer looks superb again! Thank you for this! /lgtm |
@rosti I have no experience in using cherry-pick on the kubernetes repository, so can you cherry-pick this change? Thanks. Can you tell me how to cherry-pick on the kubernetes repository if you have time? I want to study it and if there is a similar operation in the future, i can do it. Thanks. |
@pytimer please, follow this guide. It's really simple. If you have issues you can ping me to do it. Thanks! |
/test pull-kubernetes-godeps |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
/test pull-kubernetes-e2e-kops-aws |
1 similar comment
/test pull-kubernetes-e2e-kops-aws |
/test pull-kubernetes-integration |
/test pull-kubernetes-e2e-kops-aws |
…5-upstream-release-1.13 Automated cherry pick of #71945: kubeadm: fixed etcd sync endpoints
What type of PR is this?
What this PR does / why we need it:
This PR fix kubeadm sync etcd endpoints problem.
Which issue(s) this PR fixes:
Fixes kubernetes/kubeadm#1300
Special notes for your reviewer:
Does this PR introduce a user-facing change?: