refactor services to v1beta3
This commit is contained in:
@@ -392,19 +392,19 @@ func ValidateService(service *api.Service) errs.ValidationErrorList {
|
||||
if !util.IsDNSSubdomain(service.Namespace) {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("namespace", service.Namespace))
|
||||
}
|
||||
if !util.IsValidPortNum(service.Port) {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("port", service.Port))
|
||||
if !util.IsValidPortNum(service.Spec.Port) {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("spec.port", service.Spec.Port))
|
||||
}
|
||||
if len(service.Protocol) == 0 {
|
||||
service.Protocol = "TCP"
|
||||
} else if !supportedPortProtocols.Has(strings.ToUpper(string(service.Protocol))) {
|
||||
allErrs = append(allErrs, errs.NewFieldNotSupported("protocol", service.Protocol))
|
||||
if len(service.Spec.Protocol) == 0 {
|
||||
service.Spec.Protocol = "TCP"
|
||||
} else if !supportedPortProtocols.Has(strings.ToUpper(string(service.Spec.Protocol))) {
|
||||
allErrs = append(allErrs, errs.NewFieldNotSupported("spec.protocol", service.Spec.Protocol))
|
||||
}
|
||||
if labels.Set(service.Selector).AsSelector().Empty() {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("selector", service.Selector))
|
||||
if labels.Set(service.Spec.Selector).AsSelector().Empty() {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("spec.selector", service.Spec.Selector))
|
||||
}
|
||||
allErrs = append(allErrs, validateLabels(service.Labels)...)
|
||||
allErrs = append(allErrs, validateLabels(service.Selector)...)
|
||||
allErrs = append(allErrs, validateLabels(service.Spec.Selector)...)
|
||||
return allErrs
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user