From 318f9e6b0ec420400d90a1e8af032da13552c131 Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Thu, 19 Oct 2017 17:32:25 +0800 Subject: [PATCH] fix error message of custrom resource validation Kubernetes-commit: 9aed856664ba2a2b6d41c3f5ddec4c574e2a6309 --- pkg/registry/customresource/strategy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/registry/customresource/strategy.go b/pkg/registry/customresource/strategy.go index 18c6c2b74..f001dc57a 100644 --- a/pkg/registry/customresource/strategy.go +++ b/pkg/registry/customresource/strategy.go @@ -135,7 +135,7 @@ func (a customResourceValidator) Validate(ctx genericapirequest.Context, obj run return field.ErrorList{field.Invalid(field.NewPath("kind"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Kind))} } if typeAccessor.GetAPIVersion() != a.kind.Group+"/"+a.kind.Version { - return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))} + return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetAPIVersion(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))} } customResourceObject, ok := obj.(*unstructured.Unstructured) @@ -169,7 +169,7 @@ func (a customResourceValidator) ValidateUpdate(ctx genericapirequest.Context, o return field.ErrorList{field.Invalid(field.NewPath("kind"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Kind))} } if typeAccessor.GetAPIVersion() != a.kind.Group+"/"+a.kind.Version { - return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))} + return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetAPIVersion(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))} } customResourceObject, ok := obj.(*unstructured.Unstructured)