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

kubeadm: fixed etcd sync endpoints #71945

Merged
merged 1 commit into from
Dec 14, 2018

Conversation

pytimer
Copy link
Contributor

@pytimer pytimer commented Dec 11, 2018

What type of PR is this?

Uncomment only one, leave it on its own line:

/kind bug

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?:

kubeadm: fix a bug when syncing etcd endpoints

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Dec 11, 2018
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Dec 11, 2018
Copy link
Contributor

@rosti rosti left a 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

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Dec 11, 2018
@rosti
Copy link
Contributor

rosti commented Dec 11, 2018

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Dec 11, 2018
@rosti
Copy link
Contributor

rosti commented Dec 11, 2018

/test pull-kubernetes-e2e-gce-100-performance

Copy link
Member

@neolit123 neolit123 left a 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{
Copy link
Member

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.

Copy link
Contributor Author

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) {}

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

/hold

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabriziopandini @neolit123

Fix like:

func (c Client) Sync() ([]string, error) {}

Is it ok?

Copy link
Contributor

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.

Copy link
Member

@neolit123 neolit123 Dec 12, 2018

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.

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 11, 2018
@pytimer
Copy link
Contributor Author

pytimer commented Dec 12, 2018

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.

@neolit123
Copy link
Member

@pytimer
added a comment here: #71945 (comment)

please also make the release note in the OP:
kubeadm: fix a bug when syncing etcd endpoints
instead of NONE.

thanks.

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Dec 13, 2018
@pytimer
Copy link
Contributor Author

pytimer commented Dec 13, 2018

@neolit123 @fabriziopandini @rosti

I bring back (c *Client) Sync(), and edit comment according to @neolit123 feedback. Can you check it out?

Please let me know if i need to do other things. thanks.

@neolit123
Copy link
Member

@pytimer
thanks for the update.

@pytimer
Copy link
Contributor Author

pytimer commented Dec 13, 2018

/test pull-kubernetes-e2e-gce-100-performance

@fabriziopandini
Copy link
Member

@pytimer thanks!
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 13, 2018
@rosti
Copy link
Contributor

rosti commented Dec 13, 2018

@pytimer looks superb again! Thank you for this!
We have to do a cherry-pick of this change for 1.13. If you can't handle this yourself, I can do it. Just let me know.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 13, 2018
@pytimer
Copy link
Contributor Author

pytimer commented Dec 13, 2018

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

@rosti
Copy link
Contributor

rosti commented Dec 13, 2018

@pytimer please, follow this guide. It's really simple. If you have issues you can ping me to do it. Thanks!
https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md

@rosti
Copy link
Contributor

rosti commented Dec 13, 2018

/test pull-kubernetes-godeps

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

2 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@pytimer
Copy link
Contributor Author

pytimer commented Dec 14, 2018

/test pull-kubernetes-e2e-kops-aws

1 similar comment
@pytimer
Copy link
Contributor Author

pytimer commented Dec 14, 2018

/test pull-kubernetes-e2e-kops-aws

@pytimer
Copy link
Contributor Author

pytimer commented Dec 14, 2018

/test pull-kubernetes-integration

@pytimer
Copy link
Contributor Author

pytimer commented Dec 14, 2018

/test pull-kubernetes-e2e-kops-aws

@pytimer
Copy link
Contributor Author

pytimer commented Dec 14, 2018

@rosti Thanks for you help about cherry-pick. I already cherry-pick this PR.

Cherry pick is #72042.

k8s-ci-robot added a commit that referenced this pull request Dec 28, 2018
…5-upstream-release-1.13

Automated cherry pick of #71945: kubeadm: fixed etcd sync endpoints
@pytimer pytimer deleted the kubeadm-etcd-fix branch February 22, 2019 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubeadm reset success but this node ip still in kubeadm-config configmap
6 participants