Merge pull request #639 from rafael/validate_pods

Validate pod on create and update.
This commit is contained in:
Daniel Smith
2014-07-28 18:49:51 -07:00
3 changed files with 78 additions and 6 deletions

View File

@@ -281,6 +281,16 @@ func ValidateManifest(manifest *ContainerManifest) []error {
return []error(allErrs)
}
// Pod tests if required fields in the pod are set.
func ValidatePod(pod *Pod) []error {
allErrs := errorList{}
if pod.ID == "" {
allErrs.Append(makeInvalidError("Pod.ID", pod.ID))
}
allErrs.Append(ValidateManifest(&pod.DesiredState.Manifest)...)
return []error(allErrs)
}
// ValidateService tests if required fields in the service are set.
func ValidateService(service *Service) []error {
allErrs := errorList{}