mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-21 01:26:28 +00:00
Fix examples test by setting a context prior to validation
This commit is contained in:
parent
0312d80ffa
commit
e032c3075c
@ -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
Block a user