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

Dual-stack: fix the bug that Service clusterIP does not respect specified ipFamily #89612

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented Mar 28, 2020

Signed-off-by: SataQiu 1527062125@qq.com

What type of PR is this?
/kind bug

What this PR does / why we need it:
Fix the bug that Service clusterIP does not respect specified ipFamily

Which issue(s) this PR fixes:

Fixes #89610

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

dual-stack: fix the bug that Service clusterIP does not respect specified ipFamily

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

NONE

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. 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. labels Mar 28, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Mar 28, 2020

/cc @aojea @uablrek

@@ -574,7 +574,9 @@ func (r *REST) getAllocatorBySpec(service *api.Service) ipallocator.Interface {
}

secondaryAllocatorCIDR := r.secondaryServiceIPs.CIDR()
if *(service.Spec.IPFamily) == api.IPv6Protocol && netutil.IsIPv6CIDR(&secondaryAllocatorCIDR) {
secondaryAllocatorIsIPv6 := netutil.IsIPv6CIDR(&secondaryAllocatorCIDR)
if *(service.Spec.IPFamily) == api.IPv6Protocol && secondaryAllocatorIsIPv6 ||
Copy link
Member

Choose a reason for hiding this comment

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

looking at the method
func (r *REST) getAllocatorByClusterIP(service *api.Service) ipallocator.Interface {

https://github.com/kubernetes/kubernetes/pull/89612/files#diff-a17c85ca4491ca68b2c928ed6221828eR556

I think that it has the same problem and we should fix it there too.

@aojea
Copy link
Member

aojea commented Mar 28, 2020

Just one comment to fix https://github.com/kubernetes/kubernetes/pull/89612/files#diff-a17c85ca4491ca68b2c928ed6221828eR556 too.
Also, we should add unit tests to cover these scenarios
Thanks for the quick fix though

@aojea
Copy link
Member

aojea commented Mar 28, 2020

/sig network
/assign @thockin

@k8s-ci-robot k8s-ci-robot added sig/network Categorizes an issue or PR as relevant to SIG Network. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 28, 2020
@liggitt
Copy link
Member

liggitt commented Mar 29, 2020

cc @smarterclayton
this looks related to the long-lived PR Clayton is working on… I'm not sure if the fixes there would include a fix for this

this also needs a test demonstrating the bug and that this fixes the issue

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 29, 2020
Copy link
Contributor

@uablrek uablrek left a comment

Choose a reason for hiding this comment

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

lgtm. Also verified that is works on cluster.

@aojea
Copy link
Member

aojea commented Mar 29, 2020

this looks related to the long-lived PR Clayton is working on… I'm not sure if the fixes there would include a fix for this

@liggitt I think that Clayton's PR is totally related but it's leaning towards a more in deep revision of the whole dual-stack API and is not likely to be merged soon, however, this PR is just fixing current dual-stack implementation that assumes that the secondary ip allocator is always ipv6.

this also needs a test demonstrating the bug and that this fixes the issue

Absolutely, I think that this is something that we should stress for going to beta with dual-stack, IMHO at least we should have:

  • skew version testing
  • e2e test with ipv4 primary ipv6 secondary
  • e2e test with ipv6 primary ipv4 secondary

@aramase do you think that we can add another job like current azure-dual stack end to end with IPv6 as primary address?

https://k8s-testgrid.appspot.com/sig-network-dualstack-azure-e2e#dualstack-azure-e2e-master

meanwhile it seems we have to rely on manual testing, per @uablrek comment

lgtm. Also verified that is works on cluster.

and unit testing :(

Anyway, this is LGTM to me but I defer to @thockin and @smarterclayton the last decision.

@aojea
Copy link
Member

aojea commented Mar 29, 2020

hmm I think that I understand your point @liggitt 😅

spec:
  clusterIP: fd00:10:96::x
  ipFamily: IPv4

clusterIP and ipFamily doesn't match
xref #89526 (comment)

@uablrek
Copy link
Contributor

uablrek commented Mar 29, 2020

@aojea How did you get that? I have not seen anything like that.

@aojea
Copy link
Member

aojea commented Mar 29, 2020

@aojea How did you get that? I have not seen anything like that.

#89526 (comment)

@uablrek
Copy link
Contributor

uablrek commented Mar 29, 2020

Ah, I thught it was with this PR. Thanks.

@duylong
Copy link

duylong commented Mar 30, 2020

Do you know if this merge will be provided in a version 1.19 or 1.18.x ?? because currently, I have a dualstack ipv6/ipv4 cluster but I cannot use ipv4 o :-)

@liggitt
Copy link
Member

liggitt commented Mar 30, 2020

in general, I would not expect backports for alpha-level features

@SataQiu
Copy link
Member Author

SataQiu commented Mar 30, 2020

/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 Mar 30, 2020
@aramase
Copy link
Member

aramase commented Apr 1, 2020

@aramase do you think that we can add another job like current azure-dual stack end to end with IPv6 as primary address?

@aojea I can definitely do that. It requires some changes in aks-engine to allow that. I'll make the changes and add a job so we can validate v6-v4 scenario as well.

@aojea
Copy link
Member

aojea commented Apr 2, 2020

that will be awesome, we can add it to the new KEP review ...

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 2, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SataQiu, thockin

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 Apr 2, 2020
@k8s-ci-robot k8s-ci-robot merged commit 489d371 into kubernetes:master Apr 3, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Apr 3, 2020
@duylong
Copy link

duylong commented Apr 3, 2020

Nice, it only remains to wait for the release :)

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. 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. 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/network Categorizes an issue or PR as relevant to SIG Network. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dual-stack with base family IPv6: Services with ipFamily:IPv4 gets ipv6 addresses
8 participants