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

fix service port allocator same port number different protocol issue #29771

Closed
wants to merge 1 commit into from

Conversation

adohe-zz
Copy link

@adohe-zz adohe-zz commented Jul 29, 2016

Try to fix #20092
@thockin ptal.

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Jul 29, 2016
@k8s-bot
Copy link

k8s-bot commented Jul 29, 2016

GCE e2e build/test failed for commit 76dc81c.

Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake.

@adohe-zz
Copy link
Author

Close this as it will not fix the original issue.

@adohe-zz adohe-zz closed this Jul 31, 2016
@adohe-zz adohe-zz deleted the service_port branch July 31, 2016 03:31
@thockin
Copy link
Member

thockin commented Aug 1, 2016

This alone is insufficient, but we might get away without storing two maps by simply saying

  • the port map is unified across protocols
  • if a service has 2 ports that use the same port number but different protocols, allocate the first nodePort and use the same value for the 2nd port

This will prevent the case of ports being used in one protocol but not the other and failing to allocate.

Something like:

ServicePortToNodePort := map[int][int]{}
for i, sp := svc.Spec.Ports {
    np := ServicePortToNodePort[sp.Port]
    if np == 0 {
        np = allocateUnusedNodePort()
        ServicePortToNodePort[sp.Port] = np
    }
    sp.NodePort = np
}

I haven;t tried too hard to break it, but something like that MIGHT work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NodePort allocation conflates TCP and UDP
7 participants