Merge pull request #30932 from derekwaynecarr/fix-30909
Automatic merge from submit-queue Service with type=NodePort and clusterIP=None is not allowed Fixes https://github.com/kubernetes/kubernetes/issues/30908
This commit is contained in:
@@ -2463,6 +2463,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"))
|
||||
|
Reference in New Issue
Block a user