-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Introduce a ReplacementTransformer to replace the vars feature. #3492
Comments
Yes. 90% of partial replacements are swapping out some clearly defined subelement of a path, URL domain spec, IP number or something that looks like one of those things. For this, we just need an integer field in the source and target spec called The I'm not enthusiastic about offering general regexp replacement, as it's too unstructured - it will be used as a means to introduce $variables through the side door and thus miss the point of having a usable base. |
@monopole sorry, I moved my message to #2052 (comment) as I thought it made more sense there. But the email still reached you. This was my original comment:
As for the solution described here:
Yes, this seems powerful enough to get the job done for the use-case I have in mind.
How would that happen? With the replacement transformer as described, there is no need for any $(VAR) notation in the YAML. |
Right, it intentionally cannot happen under the described behavior. |
@monopole JFYI,
both based on kyaml, but they still may depend on apimachinery in some ways, e.g. for label filtering [1] Speaking about different features like 'partial replacements': The second one uses jsonpath to reference part of docs, which is pretty cool. [1] |
Planning to pick this up after completion of kubernetes/enhancements#2206 |
Considering the existing transformer and the two suggested by @aodinokov above,
The Most of the time I've seen people use E.g. people might organize cluster configuration data on disk in directories named to match cluster namespaces. So one might want to replace parts of file path in various places with the value found in the |
|
closed by #3737 |
Was
|
Hi, I think it would be more useful if -1, didn't prepend, and would instead target the last element of the field, and -2 the next to last, and so forth. Append, prepend would instead be options if that is wanted. This is usually how programming languages work anyway. Either this, or allow referencing the length. |
Hi.., I can see the comment mentioned in the beginning of this issue that the suggestion to move the VARS to Replacements with option handle Integer Value., I'm stuck with replacement that while referring PORT from configMap it gives String instead of Integer but the POD definition expect Integer. Is there any workaround for this. |
Let's replace the
vars
feature (see discussion in #2052), then deprecatevars
.Here's an untested, unused replacement transformer which could be used as raw material.
It refers to a replacement object, currently unused and mutable.
To close this issue, we'd need a new transformer plugin (any kind - go, executable, krm function). If go plugin, stick it under examples.
The plugin would accept a source (object and field spec) and, say, N targets (also object and field specs), then look for targets and replace whatever's found in those fields with whatever's found in the source.
8080
) or a boolean (e.g. an unquotedtrue
orfalse
), and has an RNode yaml tag indicating as much, then this type should be respected when written into the target (and not get quoted - see use ofsuspend: $(SUSPENDED)
in [Question] Setting 'suspend' parameter in Argo Cron workflow based on overlay #3449)A follow on issue (not filed at time of writing) would modify the
kustomize fix
command to examine someone's kustomization file and related files and convert anyvar
use to use of a replacement transformer.The text was updated successfully, but these errors were encountered: