mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
kubectl stops rendering List as suffix kind name for CRD resources
This commit is contained in:
parent
44ede98e94
commit
82cc3b5d59
@ -18,7 +18,6 @@ package validation
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
@ -54,7 +53,7 @@ func (v *SchemaValidation) ValidateBytes(data []byte) error {
|
||||
return utilerrors.NewAggregate(errs)
|
||||
}
|
||||
|
||||
if strings.HasSuffix(gvk.Kind, "List") {
|
||||
if (gvk == schema.GroupVersionKind{Version: "v1", Kind: "List"}) {
|
||||
return utilerrors.NewAggregate(v.validateList(obj))
|
||||
}
|
||||
|
||||
|
@ -394,4 +394,16 @@ items:
|
||||
`))
|
||||
Expect(err.Error()).To(Equal("[kind not set, apiVersion not set]"))
|
||||
})
|
||||
|
||||
It("is fine with crd resource with List as a suffix kind name, which may not be a list of resources", func() {
|
||||
err := validator.ValidateBytes([]byte(`
|
||||
apiVersion: fake.com/v1
|
||||
kind: FakeList
|
||||
metadata:
|
||||
name: fake
|
||||
spec:
|
||||
foo: bar
|
||||
`))
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user