Move validation of load balancers only supporting TCP ports to validation.go.

This commit is contained in:
Alex Robinson
2015-04-03 19:06:25 +00:00
parent 2b14fc1d14
commit 9a351e3670
4 changed files with 39 additions and 23 deletions

View File

@@ -927,6 +927,14 @@ func ValidateService(service *api.Service) errs.ValidationErrorList {
}
}
if service.Spec.CreateExternalLoadBalancer {
for i := range service.Spec.Ports {
if service.Spec.Ports[i].Protocol != api.ProtocolTCP {
allErrs = append(allErrs, errs.NewFieldInvalid("spec.ports", service.Spec.Ports[i], "cannot create an external load balancer with non-TCP ports"))
}
}
}
return allErrs
}