Updated types API to include session affinity. …

- changed CLIENT-IP and NONE to be ClientIP and None respectively
 - updated conversions to support translating between api versions.
 - updated validations to validate session affinity type if specified.
This commit is contained in:
Mike Foley
2014-12-17 07:52:11 -05:00
parent ff305003f0
commit 569ce87f0e
7 changed files with 78 additions and 0 deletions

View File

@@ -414,6 +414,8 @@ func ValidatePodUpdate(newPod, oldPod *api.Pod) errs.ValidationErrorList {
return allErrs
}
var supportedSessionAffinityType = util.NewStringSet(string(api.AffinityTypeClientIP), string(api.AffinityTypeNone))
// ValidateService tests if required fields in the service are set.
func ValidateService(service *api.Service, lister ServiceLister, ctx api.Context) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{}
@@ -454,6 +456,12 @@ func ValidateService(service *api.Service, lister ServiceLister, ctx api.Context
}
}
}
if service.Spec.SessionAffinity != nil {
if !supportedSessionAffinityType.Has(string(*service.Spec.SessionAffinity)) {
allErrs = append(allErrs, errs.NewFieldNotSupported("spec.sessionAffinity", service.Spec.SessionAffinity))
}
}
return allErrs
}