mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
fix error message of custrom resource validation
This commit is contained in:
parent
f01bfd4580
commit
9aed856664
@ -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))}
|
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 {
|
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)
|
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))}
|
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 {
|
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)
|
customResourceObject, ok := obj.(*unstructured.Unstructured)
|
||||||
|
Loading…
Reference in New Issue
Block a user