mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #45773 from justinsb/servicecontroller_harmonize
Automatic merge from submit-queue servicecontroller: use consistent node criteria We have two node selection functions: includeNodeFromNodeList and getNodeConditionPredicate, and the logic is different. The logic should be the same, so remove includeNodeFromNodeList and just use getNodeConditionPredicate everywhere. Fix #45772 ```release-note servicecontroller: Fix node selection logic on initial LB creation ```
This commit is contained in:
commit
b84567a57e
@ -28,7 +28,6 @@ go_library(
|
|||||||
"//pkg/util/metrics:go_default_library",
|
"//pkg/util/metrics:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||||
|
@ -26,7 +26,6 @@ import (
|
|||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/apimachinery/pkg/util/runtime"
|
"k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
@ -348,22 +347,15 @@ func (s *ServiceController) persistUpdate(service *v1.Service) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceController) createLoadBalancer(service *v1.Service) (*v1.LoadBalancerStatus, error) {
|
func (s *ServiceController) createLoadBalancer(service *v1.Service) (*v1.LoadBalancerStatus, error) {
|
||||||
nodes, err := s.nodeLister.List(labels.Everything())
|
nodes, err := s.nodeLister.ListWithPredicate(getNodeConditionPredicate())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
lbNodes := []*v1.Node{}
|
|
||||||
for ix := range nodes {
|
|
||||||
if includeNodeFromNodeList(nodes[ix]) {
|
|
||||||
lbNodes = append(lbNodes, nodes[ix])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// - Only one protocol supported per service
|
// - Only one protocol supported per service
|
||||||
// - Not all cloud providers support all protocols and the next step is expected to return
|
// - Not all cloud providers support all protocols and the next step is expected to return
|
||||||
// an error for unsupported protocols
|
// an error for unsupported protocols
|
||||||
return s.balancer.EnsureLoadBalancer(s.clusterName, service, lbNodes)
|
return s.balancer.EnsureLoadBalancer(s.clusterName, service, nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListKeys implements the interface required by DeltaFIFO to list the keys we
|
// ListKeys implements the interface required by DeltaFIFO to list the keys we
|
||||||
|
Loading…
Reference in New Issue
Block a user