kubernetes-sigs/kubectl-validate

Validation fails for files with only `---`

fuji8 opened this issue · 4 comments

What happened?

Validating a file containing only --- will cause validation to fail.

kubectl-validate has3hyphen.yaml 

has3hyphen.yaml...ERROR
GVK cannot be empty
Error: validation failed

What did you expect to happen?

This file is essentially an empty file, and I expect the validation to succeed as well as a file containing only comments.

How can we reproduce it (as minimally and precisely as possible)?

has3hyphen.yaml

---

Validate the above file.

kubectl-validate has3hyphen.yaml 

has3hyphen.yaml...ERROR
GVK cannot be empty
Error: validation failed

Anything else we need to know?

No response

Kubernetes version

kubectl version
Client Version: v1.28.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.2

I agree this is a bug. Lots of files by convention contain empty doccuments. We should ignore them

/label good-first-issue
/assign

@alexzielenski: The label(s) /label good-first-issue cannot be applied. These labels are supported: api-review, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, team/katacoda, refactor. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

In response to this:

I agree this is a bug. Lots of files by convention contain empty doccuments. We should ignore them

/label good-first-issue
/assign

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Hi @alexzielenski, i would like to take a look at this if its ok?