-
Notifications
You must be signed in to change notification settings - Fork 13
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
What is the most ideomatic way of rendering inline JSON in CRD ? #339
Comments
Hi @eshepelyuk, again you bring up an interesting topic. In the further explanations I am focusing on the value of First off, I think you can easily distinguish the case where you just want to have plain JSON in the value of
yielding identical output:
More interesting is of course the possibility of dynamic alteration of Using This means when using this input:
yields the dictionary in YAML form:
The added benefit is that it allows to make dynamic changes to the content (see Now lastly, if you want to obtain a serialized value for This method has the advantages:
Downside is that you need to define the source dictionary under Documentation around serialization options can be found here if you do a find But I think you are actually after a different thing here: serializing inline definitions without reusage of the content elsewhere. I did a quick implementation test whether I can make a combination of
I was able to produce this (yet unpolished) output:
If you would prefer such a possilibility I can look into cleanly implementing it as a feature, I do see some usecases for this. Let me know if you think that is a better option for you than what you have currently and if your questions are answered sufficiently, thank you. |
Hello @gre9ory Thanks for the great explanation, as you're usually providing.
Yes, you're right, I was looking for this, how to render inline JSON without defining temporary variables. |
Sorry, maybe I wasn't clear. That functionality is not available right now, I did a quick test implementation to see if it would work and first impression judging on the outcome was that it looked pretty good and should be doable. So right now you can do these serializations for I did not initially think about your use case but as said it makes sense so I will try to integrate it so that |
Thank you. |
This took longer than expected but it made me learn, discover and reevaluate a few things which makes the overall product better so it was worth it. The problem I had was with returning and serializing arrays but after a while I found the solution: the Helm function Discovering Now you can just use
The same works for
or any other array. Nice :) Also took some time to restructure and cleanup the transformation documentation. Maybe you find it interesting to read if it makes (more) sense. Regarding your case, the following should now work correctly:
As an bonus I found that it even works with block style input - but only when serializing the result during the process:
But please note that block style syntax is generally not supported! It only (seems) to work when paired with a serialization command and still has the known pitfalls due to indentation and white space chomping. So the general and safe advice is to use flow style syntax. Will inform here when release(s) have been built soon. |
Great news, appreciated for update. |
HULL 1.31.2 is released. Releases for 1.30 and 1.29 will follow in the next days. Let me know if it works for you as expected. Thanks. |
Sure, as soon as |
Confirmed, works as described ! |
Hello
I have to render CRD looking smth like this
Using naive
_HT!{{ .. }}
block, I am receiving YAML result and according to docs it's an expected behaviour.So to render inline JSON - I've declared a new value in
hull.config.specific
and later used_HT*toPrettyJson|hull.config.specific.inlineJson
to render it.It works OK now, but I'd like to understand
Thanks in advance.
The text was updated successfully, but these errors were encountered: