Merge pull request #759 from brendandburns/valid

Add c-identifier validation to service ids.
This commit is contained in:
Daniel Smith
2014-08-05 12:32:02 -07:00
4 changed files with 37 additions and 1 deletions

View File

@@ -302,6 +302,8 @@ func ValidateService(service *Service) []error {
allErrs := errorList{}
if service.ID == "" {
allErrs.Append(makeInvalidError("Service.ID", service.ID))
} else if !util.IsDNS952Label(service.ID) {
allErrs.Append(makeInvalidError("Service.ID", service.ID))
}
if labels.Set(service.Selector).AsSelector().Empty() {
allErrs.Append(makeInvalidError("Service.Selector", service.Selector))