-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
k3s server does not ignore empty YAML documents in manifests #222
Comments
Seems like the bug originates in controller.go - function Maybe adding a condition to check whether |
I tried my hand at a solution (see PR #225 ), happy to receive feedback |
@matej-g Unfortunately, your solution won't really work, cause
|
I've tried another approach here, see #229 |
More elegant but are you sure your solution will actually work? From what I gather: Ad 1) the separator is not included in the Ad 2) True, this is a case I did not consider Ad 3) AFAIK
So it does not separate the comment, it includes it as part of every YAML. Not saying that we could not also address an edge case where YAML is comment only, but it does not seem to be common case. |
@matej-g Well, I am pretty much sure my solution works (although there might be more edge cases we have not thought of yet), cause I did test it with a couple of manifests having empty yaml objects (or yaml objects with comments only) in the beginning/middle/end of a manifest. Your solution did not work with them. |
You are right, I was commenting before I actually had a closer look, seems like your solution covers all the scenarios (regardless of whether raw YAML starts with Helm chart just surprised me a bit because normally I don't see separation between In that case I will close my PR and would suggest to accept your solution. |
Do not process empty yaml objects (fixes #222)
Reopening for testing |
Tried several variations of "empty" documents in the manifest:
No errors and the configmaps were created:
|
Thanks for testing @dnoland1! |
Describe the bug
k3s fails to load YAML-manifests with an "empty" document, failing with this error:
failed to process /var/lib/rancher/k3s/server/manifests/metallb.yaml: Object 'Kind' is missing in 'null'
To Reproduce
/var/lib/rancher/k3s/server/manifests
:Notice the extra
---
and blank line at the end, which indicates the start of a new document, which happens to be empty.Expected behavior
It would be nice if empty documents could just be ignored.
Additional context
Similar problem in a different project: kubernetes-sigs/kustomize#178
The text was updated successfully, but these errors were encountered: