mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Merge pull request #83934 from wccsama/wcc-service-dev
Convert error messages to use event recorder
This commit is contained in:
commit
de9a7d863d
@ -547,33 +547,18 @@ func (s *ServiceController) needsUpdate(oldService *v1.Service, newService *v1.S
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPortsForLB(service *v1.Service) ([]*v1.ServicePort, error) {
|
func getPortsForLB(service *v1.Service) []*v1.ServicePort {
|
||||||
var protocol v1.Protocol
|
|
||||||
|
|
||||||
ports := []*v1.ServicePort{}
|
ports := []*v1.ServicePort{}
|
||||||
for i := range service.Spec.Ports {
|
for i := range service.Spec.Ports {
|
||||||
sp := &service.Spec.Ports[i]
|
sp := &service.Spec.Ports[i]
|
||||||
// The check on protocol was removed here. The cloud provider itself is now responsible for all protocol validation
|
|
||||||
ports = append(ports, sp)
|
ports = append(ports, sp)
|
||||||
if protocol == "" {
|
|
||||||
protocol = sp.Protocol
|
|
||||||
} else if protocol != sp.Protocol && wantsLoadBalancer(service) {
|
|
||||||
// TODO: Convert error messages to use event recorder
|
|
||||||
return nil, fmt.Errorf("mixed protocol external load balancers are not supported")
|
|
||||||
}
|
}
|
||||||
}
|
return ports
|
||||||
return ports, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func portsEqualForLB(x, y *v1.Service) bool {
|
func portsEqualForLB(x, y *v1.Service) bool {
|
||||||
xPorts, err := getPortsForLB(x)
|
xPorts := getPortsForLB(x)
|
||||||
if err != nil {
|
yPorts := getPortsForLB(y)
|
||||||
return false
|
|
||||||
}
|
|
||||||
yPorts, err := getPortsForLB(y)
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return portSlicesEqualForLB(xPorts, yPorts)
|
return portSlicesEqualForLB(xPorts, yPorts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user