-
Notifications
You must be signed in to change notification settings - Fork 44
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
Issues with helm templates #114
Comments
Hi @inssein thanks for opening an issue. Admittedly I'm very outside of the Kubernetes world so I can't say confidently why this wouldn't work. I don't know much about helm charting. I think it's in scope for the project, I would really love it to work because helm charts are such a heavy spot where people use lots of yaml. It would be a big help if you could post an example of a helm chart that failed (with any info redacted of course) so I could look into it and see if it's something that's fixable. Perhaps helm charts use a different yaml syntax or something that I don't know about. |
@braydonk for sure, here is an example I took from our repository:
When I run this file through
|
Ah I see. It's the templating language. Those aren't valid yaml, so the yaml parser is complaining about that. I think it would be very challenging to support this, except for potentially making a whole new formatter that instead parses helm chart templates. If that exists it potentially could be done, but as it is those template files won't work with Are there any helm files that are not templates that also fail in some way? |
I haven't come across any other failures yet. I guess one improvement I can see right away is that when there is an error, no formatting is done to any of the other files. Would be good to skip over the templating files that error out and still get the rest of the files in the interim. |
Yeah I think that's a simple change that I should have done a while ago, and I'll put it on my list. I always put it off because one of the original usages of the tool when I first made it was to fail if there was any invalid YAML by design. The way I handle it right now is not very elegant though, I can make it much nicer. In the meantime, if you exclude the |
I took a look at it, and I think it would be at the moment infeasible for me to implement support for Helm chart templates. Most of the functionality of this tool relies on being able to parse something as valid YAML and output the same valid YAML. It might be possible for this to be implemented, but it would unfortunately require basically reimplementing the YAML parser to also recognize the Go templating language that Helm uses mixed in with YAML. It's not impossible, but I am probably not going to be able to add support for it any time soon. I definitely will include the continuing on error functionality, so that the whole program doesn't fail upon a single file being incorrect. |
I added the functionality you suggested where I think I'm going to close this for now due to helm templates being very difficult to include at this time, although I would like to support them some day I probably won't be able to address it any time soon. Thank you for your help with examples and feedback! |
Thank you @braydonk. Best open source interaction in a while :) |
Thank you @inssein that means a lot! |
Might be out of scope for this project, but I was trying to use
yamlfmt
on our charts repository and it ran into all sorts of errors with the templates.Example of error:
The text was updated successfully, but these errors were encountered: