Fix examples test by setting a context prior to validation
This commit is contained in:
parent
54cc5f9405
commit
9b0f645245
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue