vars replacement overview #5046
Replies: 5 comments 3 replies
-
I think there was a saying: if KRM function is your sledge hammer then every problem is a nail! Well maybe not exactly, but something along these lines... ;-P |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
A way to define common variables is such a common requirement that all my kustomize based setups (with or without ArgoCD) have always had a companion envsubst mechanism. it would be great if kustomize offered a mechanism of its own - without having to eg generate an extra configmap just to be able to use the awkward Replacements feature. |
Beta Was this translation helpful? Give feedback.
-
I've also run into this, and I see where vars is powerful, especially when mixed with CI/CD such as ArgoCD. I've become quite fond of the Component and I can imagine a place where the only place to use a variable would be a parameterized Component. That way Kustomization objects can be left as-is, but anything that takes an argument (environment, passed in, piped?) must come through a Component. That those can't be param'd is surprising, and I've struggled with the lack of encapsulation that Components hint at. |
Beta Was this translation helpful? Give feedback.
-
I will preface this by saying that I might be wrong on my assumptions on how replacements is meant to work. From what I understand, it needs an array of every spec of fields it needs to replace written down into its definition, right? As staylorx says, parametrizing a few fields based on some variable, and then using varReplacements as a configuration to generate a broad set of definitions is quite powerful and intuitive. I can give that to anyone with barely any experience with this entire system, and they very quickly can make modifications, without having to learn the entire toolset.
It is very verbose to try to achieve a “replace all mentions of $(PROJECTROOTFOLDER)” in a set of non-trivial definitions. With Besides, I believe the deprecation of vars is poorly explained. And I think it is a mistake. From reading different discussions, I think what happened is that, (And I can’t find the references anymore, please someone help finding those references again)
Now, here, the culprit is not I think that is why |
Beta Was this translation helpful? Give feedback.
-
Background:
I read in the kustomize v5 release notes and open issue #4049 that the entire
vars
feature is deprecated, and that we are advised to usereplacements
instead.Unfortunately, if I understand correctly, replacements cannot replace all uses of vars, but there are several proposals to address some of the deficits: #3787 #4517
However, even these proposals do not completely fill the gap because they target structured data, whereas vars supports string replacement.
Another issue with
replacements
is that it does not compose in the same way thatvars
does, so it may not be possible to replace a Component using vars with one using replacements: #4099 (comment)Questions:
Is this a fair summary?
What is the strategy for resolving this impasse? I only see a deprecation notice, a partial alternative, and several (incomplete) proposals.
Am I missing something? Where can I find more discussion?
Beta Was this translation helpful? Give feedback.
All reactions