Replies: 1 comment
-
|
And yes, this is not a solution for everything - for example, arrays or objects are not resolved (or certainly not completely) by this approach. That's true, but it's an entirely different matter that deserves deeper consideration and was not part of the !!bool keys, which, in my opinion, are more critical... However, with a bit of exaggeration, what is possible (and I have tested it in some of my Helm Charts) is - surprisingly - also accepting their !!str variants... 😁 It may not seem so at first glance, but de facto, it is straightforward. In the case where we receive a !!str instead of !!map or !!seq, we pass it through |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Due to situations where, for example, "double/sequential" rendering of Go Templates occurs - see the example below:
templates: release: installedTemplate: '{{`{{ .Values | get "config" | get .Release.Name (dict) | get "installed" false }}`}}' waitTemplate: '{{`{{ .Values | get "config" | get $.Release.Name (dict) | get "wait" false }}`}}'we are forced to accept the fact that the resulting rendered value will always be !!str. In case we want to template
installed,wait, or other values that expect !!bool, we have to introduce various "workarounds" likeinstalledTemplateandwaitTemplate, which serve as a "patch" for the problem. They expect !!str, which is then converted to !!bool, and based on that, their counterparts (without theTemplatesuffix) are set.Since this solution is by no means robust, clean, or elegant, and also requires manually creating these "helper" keys, not all necessary keys are configurable in this way. Therefore, I suggest that all keys expecting !!bool automatically accept !!str variants as well, meaning
trueor"true",falseor"false". Any necessary conversion would be handled by Helmfile behind the scenes. What do you think about it? This way, we would get rid of all thesomethingTemplatekeys, and the result would be the same... For easy conversion, I propose a private method that accepts !!bool or its !!str variant and always returns a bool - here's my proposal:Beta Was this translation helpful? Give feedback.
All reactions