mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Skip hasSupport check for List type
Currently, when user applies a List type resource, there is an unnecessary request to customresourcedefinitions endpoint by validation. The reason of this request is that validation can not find List type in OpenAPI schema and behaves this type as CRD. This PR returns unsupported when List type is applied. In terms of functionality, there is no bug or any issue, because eventually `schemaValidation` detects this List and executes `validateList` function. Only issue is unnecessary CRD enpoint request.
This commit is contained in:
parent
a6c775333c
commit
e78d05daec
@ -19,7 +19,6 @@ package resource
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
openapi_v2 "github.com/google/gnostic/openapiv2"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -72,6 +71,10 @@ const (
|
||||
|
||||
// HasSupport checks if the given gvk supports the query param configured on v
|
||||
func (v *QueryParamVerifier) HasSupport(gvk schema.GroupVersionKind) error {
|
||||
if (gvk == schema.GroupVersionKind{Version: "v1", Kind: "List"}) {
|
||||
return NewParamUnsupportedError(gvk, v.queryParam)
|
||||
}
|
||||
|
||||
oapi, err := v.openAPIGetter.OpenAPISchema()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to download openapi: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user