Require at least one version in ThirdPartyResource objects

This commit is contained in:
Jordan Liggitt
2016-11-17 10:12:37 -05:00
parent 0f95b262dc
commit 7a5461a17c
4 changed files with 8 additions and 2 deletions

View File

@@ -68,6 +68,9 @@ func ValidateThirdPartyResource(obj *extensions.ThirdPartyResource) field.ErrorL
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&obj.ObjectMeta, false, ValidateThirdPartyResourceName, field.NewPath("metadata"))...)
versions := sets.String{}
if len(obj.Versions) == 0 {
allErrs = append(allErrs, field.Required(field.NewPath("versions"), "must specify at least one version"))
}
for ix := range obj.Versions {
version := &obj.Versions[ix]
if len(version.Name) == 0 {