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

Add a label which prevents a node from being added to a cloud load balancer #53146

Merged
merged 1 commit into from Sep 28, 2017

Conversation

brendandburns
Copy link
Contributor

There are a variety of reasons that you may not want a node in a cluster to participate in a cloud load balancer. For example workload isolation for security, or managing network throughput, or because the node is not in the appropriate virtual network (cluster's that span environments)

This PR adds a label so that you can select which nodes you want to participate.

@k8s-ci-robot k8s-ci-robot added 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. labels Sep 27, 2017
@brendandburns brendandburns added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 27, 2017
@FengyunPan
Copy link

/lgtm
The label can be used to node isolation.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 28, 2017
@brendandburns
Copy link
Contributor Author

/approve no-issue

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, FengyunPan

Associated issue requirement bypassed by: brendandburns

The full list of commands accepted by this bot can be found here.

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

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 28, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 6915fd5 into kubernetes:master Sep 28, 2017
FengyunPan pushed a commit to FengyunPan/kubernetes that referenced this pull request Sep 28, 2017
After merging this PR(kubernetes#53146), if there is no available nodes for
the loadbalancer service, UpdateLoadBalancer() will run panic.
@k8s-cherrypick-bot
Copy link

Removing label cherrypick-candidate because no release milestone was set. This is an invalid state and thus this PR is not being considered for cherry-pick to any release branch. Please add an appropriate release milestone and then re-add the label.

@rbitia
Copy link

rbitia commented Sep 29, 2017

Solves this issue: https://github.com/Azure/aci-connector-k8s/issues/51

@@ -598,6 +598,10 @@ func getNodeConditionPredicate() corelisters.NodeConditionPredicate {
return false
}

if _, hasExcludeBalancerLabel := node.Labels[constants.LabelNodeRoleExcludeBalancer]; hasExcludeBalancerLabel {
Copy link
Member

Choose a reason for hiding this comment

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

I just opened #53341. We shouldn't depend on cmd/kubeadm from core controllers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can fix this if food have a better location for these annotations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Erm s/food/folks/

Copy link
Member

Choose a reason for hiding this comment

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

We can fix this later I think.

@@ -134,6 +134,10 @@ const (
// It's copied over to kubeadm until it's merged in core: https://github.com/kubernetes/kubernetes/pull/39112
LabelNodeRoleMaster = "node-role.kubernetes.io/master"

// LabelNodeRoleExcludeBalancer specifies that the node should be
// exclude from load balancers created by a cloud provider.
LabelNodeRoleExcludeBalancer = "node.role.kubernetes.io/exclude-balancer"
Copy link
Member

Choose a reason for hiding this comment

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

@kubernetes/sig-network-api-reviews

This doesn't follow the convetions of other labels in this file, nor does it have any versioning. Are we committing to this API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I screwed up the cut/paste I guess. I'm happy to add the dash instead of the dot...

FengyunPan pushed a commit to FengyunPan/kubernetes that referenced this pull request Oct 9, 2017
After merging this PR(kubernetes#53146), if there is no available nodes for
the loadbalancer service, UpdateLoadBalancer() will run panic.
k8s-github-robot pushed a commit that referenced this pull request Oct 9, 2017
Automatic merge from submit-queue (batch tested with PRs 53567, 53197, 52944, 49593). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

[OpenStack]Add codes to check the count of nodes(members)

After merging this PR(#53146), if there is no available nodes for
the loadbalancer service, UpdateLoadBalancer() will run panic.

**Release note**:
```release-note
NONE
```
@brendandburns
Copy link
Contributor Author

Fixed up @mikedanese 's concern in #53621

Apologies.

Mike, if you want me to extract from kubeadm let me know the right location and I'll happily do that.

k8s-github-robot pushed a commit that referenced this pull request Oct 10, 2017
Automatic merge from submit-queue (batch tested with PRs 53621, 52320, 53625). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix a bad cut/paste of a node label.

Fixes concerns [raised](#53146 (review)) in #53146

@mikedanese @jdumars
@thockin
Copy link
Member

thockin commented Oct 10, 2017

Hey, all.

This should not have been merged without an issue, and probably should not have merged without someone from sig-network OWNERS looking at it.

In truth, the whole notion of using nodes as LB targets should be folded down into per-cloud-provider logic. Service controller should not be doing this predicate check or passing nodes around.

Secondly, the node-role concept is highly contentious, so we should not overload it.

Thirdly, "don't do X" is not a role.

Given that the nodes ARE being passed by service controller, fine. I don't think it should be about "role" though. Probably it should be named "node" rather than "node-role", or even something new like "service-controller.kubernetes.io/exclude-lb-node" ?

@thockin thockin self-assigned this Oct 10, 2017
k8s-github-robot pushed a commit that referenced this pull request Oct 28, 2017
Automatic merge from submit-queue (batch tested with PRs 54644, 53072). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Flag gate node exclusion for service load balancers.

@thockin @jdumars 

```release-note
Add a new feature gate for enabling an alpha annotation which, if present, excludes the annotated node from being added to a service load balancers.
```

Issue: #54743

Notes:
The original PR for this feature was: #53146

Which didn't include a gate (or the alpha label).

This was refined to add the `alpha` label in:
#53678

Then in the cherry-pick review:
#53656 (comment)

@thockin requested a gate for an alpha feature, which is this PR.
@jpbetz
Copy link
Contributor

jpbetz commented Nov 2, 2017

Removing cherry-pick labels since this has been manually cherrypicked in #54955

@jpbetz jpbetz removed this from the v1.8 milestone Nov 2, 2017
k8s-github-robot pushed a commit that referenced this pull request Nov 2, 2017
…#53678-#54644-upstream-release-1.8

Automatic merge from submit-queue.

Automated cherry pick of #53146 #53678 #54644

Cherry pick of #53146 #53678 #54644 on release-1.8.

#53146: Add a label which prevents a node from being added to a cloud
#53678: Append an alpha label to the exclude load balancer
#54644: wqFlag gate node exclusion for service load balancers.

```release-note
Add a label which prevents a node from being added to a cloud.Append an alpha label to the exclude load balancer. `wqFlag` gate node exclusion for service load balancers.
```
@redbaron
Copy link
Contributor

redbaron commented Nov 9, 2017

Am I right that node using this label exclude itself from all LBs? So there is no way to do this per service?

dims pushed a commit to dims/kubernetes that referenced this pull request Feb 8, 2018
After merging this PR(kubernetes#53146), if there is no available nodes for
the loadbalancer service, UpdateLoadBalancer() will run panic.
dims pushed a commit to dims/kubernetes that referenced this pull request Feb 8, 2018
Automatic merge from submit-queue (batch tested with PRs 53567, 53197, 52944, 49593). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

[OpenStack]Add codes to check the count of nodes(members)

After merging this PR(kubernetes#53146), if there is no available nodes for
the loadbalancer service, UpdateLoadBalancer() will run panic.

**Release note**:
```release-note
NONE
```
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.

None yet