carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.63k stars 137 forks source link

ytt has too steep of a learning curve #728

Open rit001 opened 1 year ago

rit001 commented 1 year ago

ytt seems to support a lot of advanced features that I could use in the future, but today I just need to pull some basic files into the output stream and so am looking for a simple import feature.

Thanks

Roger

pivotaljohn commented 1 year ago

Hey Roger!

Apologies for the long delay in answering your question.

Yes, ytt gives you the ability to load the contents of a text file into a template.

However, before I jump to a specific solution, it would be prudent to make sure we understand your needs.

Can you provide a simple example of what it is that you're trying to accomplish here?

rit001 commented 1 year ago

Hi, thanks for the reply.

I was looking for a way to just 'include' the contents of one yml file into another one. The aim was to start off with a very simple solution and then use more of ytt's features over time - having read the docs a good few times I have to say that it has something of a steep learning curve, with just about every example laid out for someone who already understands what is going on.

In the end, I used a different solution, but I do at least know that ytt exists as and when I need to do any major yml work.

pivotaljohn commented 1 year ago

The aim was to start off with a very simple solution and then use more of ytt's features over time - having read the docs a good few times I have to say that it has something of a steep learning curve, with just about every example laid out for someone who already understands what is going on.

Thank you for taking the time to give us this feedback. 🙏🏻

It's not you, we've heard this critique from many folk. We have an initiative we hope to prioritize soon to rework the whole experience of getting started with the tool. The revised experience would be more gradual, introducing each essential concept, one at a time ... and be use case-based.

We're grateful for the signal you've left here; if you have the gumption for it, we'd be delighted to hear anything you can share about your use case (not just the problem you were solving, here; but your wider needs in this area).

rit001 commented 1 year ago

The user case was rather simple.

I had a shell script that built a yml file by combining a number of different files - each logical config was just a set of files in a different directory. My first 'plan' was to find a simple way to just combine yml files by processing a yml file - much like the c programming language uses #include "something" within one file to pull in the text held in another file.

The logic was that by using a very basic #include type command I would be able to remove the shell script and instead start the process of using more advanced yml tools over time. I ended up trying to use ytt functions and the result was more complicated and less easy to understand than just using the shell script :(

In the end, I just went with a far more static yml file in each of the different config directories, with a small amount of ansible scripting, it reduced the complexity of the shell script without introducing the complexity of ytt.

The issue with ytt at the moment from my point of view is not that I can not invest the time to learn and use it, but rather whatever I put together has to be readable by whoever covers for me when I go on holiday or walk under a bus. At the moment a yml file using a range of ytt features would be just about unreadable to anyone who has not spent a lot of time learning ytt, which is something of a problem as the supporting docs are not currently aimed at such people and so they would be unable to get up to speed.

pivotaljohn commented 1 year ago

This is very helpful, Roger. Thank you for taking the time to articulate your experience.

This really stuck out for me:

The issue with ytt at the moment from my point of view is not that I can not invest the time to learn and use it, but rather whatever I put together has to be readable by whoever covers for me when I go on holiday or walk under a bus.

I'm more proud of producing a solution that decreases the cost of maintenance; this is deeply personally motivating.

m0un10 commented 1 year ago

I just have to say, it's great to see this discussion. I also had wondered, why do I need to write a bash script to make it usable by casual users? If you can solve that, this thing really takes off. There is however an alternative to includes. The strategy I have taken for every project that I've used YTT for is to go with file and directory conventions. You put files in a specific place and it "just works", thanks in large part to my bash script that has some logic (it doesn't simply wrap "-f" args). I considered to open source it as an opinionated reference implementation (and still might) but honestly it would be way better if this got built in as a mode for ytt.