Service with type=NodePortr and clusterIP=None is not allowed

This commit is contained in:
derekwaynecarr
2016-08-18 17:50:09 -04:00
committed by Derek Carr
parent 6fa4042211
commit 023bf87c38
2 changed files with 27 additions and 0 deletions

View File

@@ -2455,6 +2455,10 @@ func validateServiceFields(service *api.Service) field.ErrorList {
if service.Spec.ClusterIP == "None" {
allErrs = append(allErrs, field.Invalid(specPath.Child("clusterIP"), service.Spec.ClusterIP, "may not be set to 'None' for LoadBalancer services"))
}
case api.ServiceTypeNodePort:
if service.Spec.ClusterIP == "None" {
allErrs = append(allErrs, field.Invalid(specPath.Child("clusterIP"), service.Spec.ClusterIP, "may not be set to 'None' for NodePort services"))
}
case api.ServiceTypeExternalName:
if service.Spec.ClusterIP != "" {
allErrs = append(allErrs, field.Invalid(specPath.Child("clusterIP"), service.Spec.ClusterIP, "must be empty for ExternalName services"))