Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log more info when validation fails due to unexpected fields on a resource #94

Open
blaivs opened this issue Mar 18, 2024 · 4 comments · May be fixed by #126
Open

Log more info when validation fails due to unexpected fields on a resource #94

blaivs opened this issue Mar 18, 2024 · 4 comments · May be fixed by #126
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@blaivs
Copy link

blaivs commented Mar 18, 2024

What would you like to be added?

When validating a resource, if there's, let's say a typo on a property, the validation results in an error where no reference to the resource that failed to validate is logged. When validating a file with several resources in it, it's hard to find which to find which one errored.

Example:

apiVersion: v1
kind: ConfigMap
metadata:
  name: x.com
datas: # extra "s"
  key: value

Error message: datas: Invalid value: value provided for unknown field

So no reference to name and kind of the resource.

This happens as when resource parsing fails, it errors without parsing metadata's name. Group and kind are returned but not attached to the error.

return gvk, nil, err

Feels like getting this basic info on the resource could be done at parse function?

Why is this needed?

It will help identifying the resource that caused the error.

@blaivs blaivs added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 18, 2024
@alexzielenski alexzielenski added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Apr 1, 2024
@alexzielenski
Copy link
Contributor

I agree parse errors should be accumulated and linked back to the original object. Attributing only to file makes it hard to reason about large yamls with many documents

@annaelizabeth2019
Copy link

/assign

@annaelizabeth2019
Copy link

unassigned myself because I'm having a bit of trouble setting up my environment and don't want to block development. I'll try a good first issue when I'm set up. :)

@omerap12
Copy link
Contributor

omerap12 commented May 4, 2024

/assign

@omerap12 omerap12 linked a pull request May 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants