Make validation check for legal serive port numbers.

This commit is contained in:
Satnam Singh
2014-08-22 14:44:21 -07:00
parent bd2cbdc312
commit 7fcaf80f67
3 changed files with 30 additions and 2 deletions

View File

@@ -260,6 +260,10 @@ func ValidateService(service *Service) errs.ErrorList {
} else if !util.IsDNS952Label(service.ID) {
allErrs = append(allErrs, errs.NewInvalid("Service.ID", service.ID))
}
// Make sure the service port number is valid.
if !util.IsValidPortNum(service.Port) {
allErrs = append(allErrs, errs.NewInvalid("Service.Port", service.Port))
}
if labels.Set(service.Selector).AsSelector().Empty() {
allErrs = append(allErrs, errs.NewInvalid("Service.Selector", service.Selector))
}