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

replace grpc.FailFast and grpc.WithDialer which is deprecated #83003

Closed
wants to merge 4 commits into from

Conversation

danielqsj
Copy link
Contributor

@danielqsj danielqsj commented Sep 23, 2019

What type of PR is this?

/kind bug
/area apiserver

What this PR does / why we need it:

Now the grpc.FailFast and grpc.WithDialer has deprecated, so use grpc.WaitForReady and grpc.WithContextDialer instead.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 23, 2019
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 23, 2019
@danielqsj danielqsj changed the title replace grpc.FailFast which is deprecated replace grpc.FailFast and grpc.WithDialer which is deprecated Sep 23, 2019
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. labels Sep 23, 2019
@danielqsj
Copy link
Contributor Author

/cc @liggitt

Copy link
Contributor

@mattjmcnaughton mattjmcnaughton left a comment

Choose a reason for hiding this comment

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

Overall, this makes sense to me (although I defer to anyone with more grpc experience than me :) )
Confirming this shouldn't cause a functionality change, correct?

One small note around the typecheck failure... I'm wondering if this needs to be coupled with winio update?

pkg/kubelet/util/util_windows.go Show resolved Hide resolved
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
return (&net.Dialer{}).DialContext(ctx, "unix", addr)
Copy link
Member

Choose a reason for hiding this comment

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

do we still need to call WithContextDialer (I expected this to be the default implementation... xref https://github.com/grpc/grpc-go/blob/master/clientconn.go#L198-L203)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks to me that switching to WithTimeout and using the default dialer impl like @liggitt suggested should preserve the previous behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liggitt @jpbetz
Maybe we can simple write like this :
c, err := grpc.DialContext(ctx, unixSocketPath, grpc.WithInsecure(), grpc.WithBlock())
Because

  1. grpc.WithDialer is actually set timeout via context.deadline , xref https://github.com/grpc/grpc-go/blob/788ffe62759ade61e0d6273e480c9e8f3d09d30d/dialoptions.go#L358-L360
  2. grpc.DialContext finally call dial.DialContext which will set deadline from context. xref https://github.com/golang/go/blob/cf06b9aa81004a017e5c98422fce2fafd1f24921/src/net/dial.go#L368-L370
    These two approach is the same, right ?
    If so, we can safely skip this option.

grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
return (&net.Dialer{}).DialContext(ctx, "unix", addr)
Copy link
Member

Choose a reason for hiding this comment

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

grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
return (&net.Dialer{}).DialContext(ctx, "unix", addr)
Copy link
Member

Choose a reason for hiding this comment

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

@liggitt
Copy link
Member

liggitt commented Sep 23, 2019

I don't have context on the failfast / WaitForReady change... who would be a good reviewer for that?

@roycaihw
Copy link
Member

/assign @jingyih

@k8s-ci-robot
Copy link
Contributor

@roycaihw: GitHub didn't allow me to assign the following users: jingyih.

Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @jingyih

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-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. area/cloudprovider area/dependency Issues or PRs related to dependency changes labels Sep 24, 2019
@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. labels Sep 24, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: danielqsj
To complete the pull request process, please assign thockin
You can assign the PR to them by writing /assign @thockin in a comment when ready.

The full list of commands accepted by this bot can be found 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 removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2019
@@ -60,6 +61,7 @@ require (
)

replace (
github.com/pkg/errors => github.com/pkg/errors v0.8.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liggitt after execute hack/update-vendor.sh, this go.mod changed to this. Should I keep it or change it to v0.8.1 ?

Copy link
Member

Choose a reason for hiding this comment

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

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Sep 24, 2019

@danielqsj: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-dependencies df63cee link /test pull-kubernetes-dependencies

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@liggitt
Copy link
Member

liggitt commented Oct 23, 2019

the vendor bump is unrelated, can you move that to a separate PR?

the FailFast(x) to WaitForReady(!x) change is straightforward. the WithContextDialer change needs much closer review to make sure we have equivalent behavior. can you split those changes so we can go ahead and merge the first?

@danielqsj
Copy link
Contributor Author

@liggitt I find the FailFast(x) was fixed by #83595.
I reopen a PR to fix the remain grpc.WithDialer in #84345.
the vendor (go-winio) bump is needed for this change to support GetAddressAndDialer refactor.

/close

@k8s-ci-robot
Copy link
Contributor

@danielqsj: Closed this PR.

In response to this:

@liggitt I find the FailFast(x) was fixed by #83595.
I reopen a PR to fix the remain grpc.WithDialer in #84345.
the vendor (go-winio) bump is needed for this change to support GetAddressAndDialer refactor.

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiserver area/cloudprovider area/dependency Issues or PRs related to dependency changes area/kubectl area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/node Categorizes an issue or PR as relevant to SIG Node. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants