Fix examples test by setting a context prior to validation

This commit is contained in:
derekwaynecarr 2014-09-29 17:38:25 -04:00
parent 0312d80ffa
commit e032c3075c

View File

@ -32,6 +32,7 @@ import (
)
func validateObject(obj runtime.Object) (errors []error) {
ctx := api.NewDefaultContext()
switch t := obj.(type) {
case *api.ReplicationController:
errors = validation.ValidateManifest(&t.DesiredState.PodTemplate.DesiredState.Manifest)
@ -40,12 +41,14 @@ func validateObject(obj runtime.Object) (errors []error) {
errors = append(errors, validateObject(&t.Items[i])...)
}
case *api.Service:
api.ValidNamespaceOnCreateOrUpdate(ctx, &t.JSONBase)
errors = validation.ValidateService(t)
case *api.ServiceList:
for i := range t.Items {
errors = append(errors, validateObject(&t.Items[i])...)
}
case *api.Pod:
api.ValidNamespaceOnCreateOrUpdate(ctx, &t.JSONBase)
errors = validation.ValidateManifest(&t.DesiredState.Manifest)
case *api.PodList:
for i := range t.Items {