Add dns-952-identifier validation to service ids.

This commit is contained in:
Brendan Burns
2014-08-03 21:02:10 -07:00
parent 07bef429b1
commit 20a8f03d62
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))