Commit 56ea95fa authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #44745 from justinsb/lb_recognize_16_unschedulable

Automatic merge from submit-queue Exclude master from LoadBalancer / NodePort The servicecontroller documents that the master is excluded from the LoadBalancer / NodePort, but this is broken for clusters where we are using taints for the master (as introduced in 1.6), instead of marking the master as unschedulable. This restores the desired documented behaviour, by excluding nodes that are labeled as masters with the new 1.6 labels, even if they use the new 1.6 taints. Fix #33884 ```release-note Exclude nodes labeled as master from LoadBalancer / NodePort; restores documented behaviour ```
parents ce2f0b19 82d600bb
...@@ -16,6 +16,7 @@ go_library( ...@@ -16,6 +16,7 @@ go_library(
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//cmd/kubeadm/app/constants:go_default_library",
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//pkg/api/v1/helper:go_default_library", "//pkg/api/v1/helper:go_default_library",
......
...@@ -34,6 +34,7 @@ import ( ...@@ -34,6 +34,7 @@ import (
"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record" "k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue" "k8s.io/client-go/util/workqueue"
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/api/v1"
v1helper "k8s.io/kubernetes/pkg/api/v1/helper" v1helper "k8s.io/kubernetes/pkg/api/v1/helper"
...@@ -599,10 +600,16 @@ func getNodeConditionPredicate() corelisters.NodeConditionPredicate { ...@@ -599,10 +600,16 @@ func getNodeConditionPredicate() corelisters.NodeConditionPredicate {
return func(node *v1.Node) bool { return func(node *v1.Node) bool {
// We add the master to the node list, but its unschedulable. So we use this to filter // We add the master to the node list, but its unschedulable. So we use this to filter
// the master. // the master.
// TODO: Use a node annotation to indicate the master
if node.Spec.Unschedulable { if node.Spec.Unschedulable {
return false return false
} }
// As of 1.6, we will taint the master, but not necessarily mark it unschedulable.
// Recognize nodes labeled as master, and filter them also, as we were doing previously.
if _, hasMasterRoleLabel := node.Labels[constants.LabelNodeRoleMaster]; hasMasterRoleLabel {
return false
}
// If we have no info, don't accept // If we have no info, don't accept
if len(node.Status.Conditions) == 0 { if len(node.Status.Conditions) == 0 {
return false return false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment