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

nodeports usage should be part of LoadBalancer service type #39364

Merged
merged 1 commit into from
Feb 18, 2017

Conversation

zhouhaibing089
Copy link
Contributor

@zhouhaibing089 zhouhaibing089 commented Jan 3, 2017

Since a creation of Service of type LoadBalancer will allocate NodePorts as well, so it makes more sense to account for the NodePort usage in the LoadBalancer switch case.

check here: https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/core/service/rest.go#L553 for the logic on whether it should assign a nodeport for the service.

services of type loadbalancer consume both loadbalancer and nodeport quota.

@k8s-ci-robot
Copy link
Contributor

Hi @zhouhaibing089. 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 @k8s-bot 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.

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.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA.

Once you've signed, please reply here (e.g. "I signed it!") and we'll verify. Thanks.


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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 3, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note-label-needed labels Jan 3, 2017
@zhouhaibing089
Copy link
Contributor Author

I signed it!

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 3, 2017
@zhouhaibing089
Copy link
Contributor Author

ping @vishh please take a look.

@vishh
Copy link
Contributor

vishh commented Jan 14, 2017

I'm torn with this PR. Although it is technically correct, from a user standpoint, when they create a external LB they do not know that a Node Port is also being consumed which might confuse users.

@derekwaynecarr WDYT?

@zhouhaibing089
Copy link
Contributor Author

zhouhaibing089 commented Jan 15, 2017

well, I have to admit that your concern is totally reasonable. anyway, I would like to clarify the background a little bit more: in some environments(openstack LBaaS as an example), a creation of vip with multiple ports will create multiple vips actually under the hood(the same ip though), so if we really want to limit the ports number, we can either:

  1. count the nodeport usage, as it actually limits how many ports can be created.(which is proposed in this pr)
  2. add another resource name like services.loadbalancer.ports, and add this into resource quota.

@vishh @derekwaynecarr what do you think?

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] Needs approval from an approver in each of these OWNERS Files:

We suggest the following people:
cc @vishh
You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@thockin
Copy link
Member

thockin commented Feb 16, 2017

/lgtm

LGTM from the bulk LGTM tool

@thockin thockin self-assigned this Feb 16, 2017
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 16, 2017
@k8s-github-robot k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Feb 16, 2017
@vishh vishh added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Feb 18, 2017
@vishh
Copy link
Contributor

vishh commented Feb 18, 2017

@thockin thinks this is fine. So LGTM

/lgtm

@vishh vishh added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. labels Feb 18, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 4d11cbc into kubernetes:master Feb 18, 2017
@derekwaynecarr
Copy link
Member

@zhouhaibing089 sorry, this fell of my radar.

this is a behavior change that warrants a release-note.

i am not sure i am fully groking the rationale. is this behavior Iaas specific?

i would have liked a unit test can you do that as well?

@derekwaynecarr derekwaynecarr added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Mar 10, 2017
@derekwaynecarr
Copy link
Member

@thockin -- am i mistaken that this pr would have made the value be 2 and not 1 node port per load balancer service? see: #29409

@marun
Copy link
Contributor

marun commented Mar 10, 2017

I think there needs to be a check that a NodePort is actually present in a given port spec rather than blindly counting the number of ports with the assumption that services of type LoadBalancer will always allocate a NodePort.

NodePort allocation is a function of the services controller when a cloud provider is configured, but that is deployment-specific. OpenShift can be configured to run a controller that allocates externalIPs to LoadBalancer services when running without a cloud provider, and no NodePort would be allocated:

https://docs.openshift.com/container-platform/latest/admin_guide/tcp_ingress_external_ports.html

Disregard, nodeports are allocated on creation so services of type LoadBalancer will always consume nodeports whether they will be used or not.

cc: @smarterclayton @knobunc

@derekwaynecarr
Copy link
Member

added unit testing #42998

k8s-github-robot pushed a commit that referenced this pull request Mar 25, 2017
Automatic merge from submit-queue

Unit test quota for nodeport associated with loadbalancer

**What this PR does / why we need it**:
This PR adds unit tests to ensure node ports associated with loadbalancers are charged to quota appropriately.  The original PR that added that feature to quota lacked a unit test (#39364)
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

8 participants