-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Replacement inbetween #5616
Comments
This issue is currently awaiting triage. SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
@Yingrjimsch I can start to discuss this now. |
First, I am Sorry to do this after you opened a PR, but I think we can't accept the current interface. I believe someone will soon open a PR that requires adding the "third delimiter" field if I accept your current PR. |
Thank you for the response. So in your opinion it should be able to make more than two delimiter? The reason for enddelimiter was to have a better capability (regex, full text replaxe) without breaking the current delimiter function. In my opinion there is the possibility to change delimiter completely to something more flexible but this leads to a breaking change. As we have experienced to fully reach its potential a single delimiter is not enough, do you think different about this? FYI: a third delimiter wouldn't make sense im my opinion because with regex you can do more complex find and replace functions |
No problem I hopebyou are feeling better now. If we can work something out that works for me and you approve it I'd appreciate it greatly |
Hmm..... For example, In my memory, the former kustomize maintainer preferred to use this. |
So how would you go on and replace the example I made in the first comment of the pull request |
First, make configMap, which contains "$(ENVIRONMENT)-myapp-observability" at value. |
@koba1t thanks for your answer. I can see how this would work, in my opinion, it is unnecessary complicated but I feel I can't convince you... if you decide there is a use for my pull request I'd be happy to assist. |
@koba1t I'm not sure if your approach is sufficiently flexible to deal with all kinds of replacement that the inbetween replacement is trying to solve. For example, how would this multiple replacement strategy work for this:
Replacing
|
I agree thanks for the great example even
out if curiosity how would you do it without? |
|
@koba1t hi kobalt any don't you think this is still relevant? If not, I've got another issue with the replacements, I want to get labelSelector:env=this|that as written here this should be possible, the label selector should be implemented this way https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/selector.go#L21 can you tell me how I can achieve that? |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
Eschewed features
What would you like to have added?
To replace inbetween to substrings or chars would be very benificial. The replacement by delimiter with an index works pretty good but in some cases it is not enough because the part to replace is between two different chars.
Why is this needed?
If for example I want to replace the major version of
nginx:1.7.9
tonginx:2.7.9
there is no right delimiter for me to use to achieve the task. We have this problem in multiple yaml replacements, where the delimiter replacement is not enough.The following issue tries to achieve something similar: #4555
Another example is we have a URL:
http://loki-backend.$(ENVIRONMENT)-myapp-observability.svc.cluster.local:3100$request_uri;
where we want to replace dynamically the$(ENVIRONMENT)
with sta, pre, pro or other environment abbreviations. For now it is not possible to replace this correctly because it is between the char.
and the char-
Can you accomplish the motivating task without this feature, and if so, how?
For now the example cannot be solved because it is between the char
.
and the char-
What other solutions have you considered?
My suggested solution is to have an additional
enddelimiter
property inreplacement.options
which can specify the second char / substring for replacement purpose. This can be done in source and target to be consistent and would have no affect on the current functionallity and a minimal code changeAnything else we should know?
I have created a branch on my fork with an implemented version, due to being new to golang I'm open for clean code or performance optimization suggestion. I also included two basic tests in the
replacement_test.go
which are calledpartial string replacement with enddelimiter in target - replace
andpartial string replacement with enddelimiter in source - replace
Feature ownership
The text was updated successfully, but these errors were encountered: