Mixed protocol support for Services with type=LoadBalancer (#94028)
* Mixed protocol support for Services with type=LoadBalancer KEP: https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/20200103-mixed-protocol-lb.md Add new feature gate to control the support of mixed protocols in Services with type=LoadBalancer Add new fields to the ServiceStatus Add Ports to the LoadBalancerIngress, so cloud provider implementations can report the status of the requested load balanc er ports Add ServiceCondition to the ServiceStatus so Service controllers can indicate the conditions of the Service * regenerate conflicting stuff
This commit is contained in:
@@ -4249,22 +4249,6 @@ func ValidateService(service *core.Service) field.ErrorList {
|
||||
allErrs = append(allErrs, field.NotSupported(specPath.Child("type"), service.Spec.Type, supportedServiceType.List()))
|
||||
}
|
||||
|
||||
if service.Spec.Type == core.ServiceTypeLoadBalancer {
|
||||
portsPath := specPath.Child("ports")
|
||||
includeProtocols := sets.NewString()
|
||||
for i := range service.Spec.Ports {
|
||||
portPath := portsPath.Index(i)
|
||||
if !supportedPortProtocols.Has(string(service.Spec.Ports[i].Protocol)) {
|
||||
allErrs = append(allErrs, field.Invalid(portPath.Child("protocol"), service.Spec.Ports[i].Protocol, "cannot create an external load balancer with non-TCP/UDP/SCTP ports"))
|
||||
} else {
|
||||
includeProtocols.Insert(string(service.Spec.Ports[i].Protocol))
|
||||
}
|
||||
}
|
||||
if includeProtocols.Len() > 1 {
|
||||
allErrs = append(allErrs, field.Invalid(portsPath, service.Spec.Ports, "cannot create an external load balancer with mix protocols"))
|
||||
}
|
||||
}
|
||||
|
||||
if service.Spec.Type == core.ServiceTypeClusterIP {
|
||||
portsPath := specPath.Child("ports")
|
||||
for i := range service.Spec.Ports {
|
||||
|
Reference in New Issue
Block a user