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
Replacements doc for key-value pair indexes doesn't mention regex and has misleading examples #5349
Comments
If #4424 introduced regex to replacements, it was unintentional and rather unfortunate and I apologize that the examples don't reflect the change. @koba1t Could you please look into this issue and verify that the indexing now supports regex? I think if we did accidentally introduce it, we probably can't revert it now (as a breaking change) unless we have a very good reason to do so, so we will probably have to document it. /assign @koba1t |
Yes, I reproduced your problem in my environment. This change is an unintended modification, but I agree with @natasha41575 because we need to avoid any further breaking changes. /triage accepted |
@koba1t: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
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. |
@jdoylei thanks for creating the issue. I have also noticed this undocumented regex behavior |
What happened?
Reference / Kustomize / kustomization / replacements explains key-value pair indexes like this:
And shows a further example like this:
This vaguely suggests that "key=value" is an exact match, particularly because regexes aren't mentioned at all.
In kustomize 4.4.1, "key=value" did seem to be an exact match, but later (kustomize 4.5.7 at least), "key=value" uses "value" as a regex, not a fixed string. This changes the behavior entirely if the input resource has multiple similar mapping nodes like "key: my_value", "key: value", and "key: your_value".
It was only after a little research and looking at enhancement pull requests like https://github.com/kubernetes-sigs/kustomize/pull/4424/files that I realized regexes were introduced.
Clarifying this in the doc would be really helpful. Users would know this is available to them, and would be less likely to be confused by regex behavior that's unexpected.
What did you expect to happen?
The docs should have been updated in 4.5.x to indicate that replacements key-value pair indexes use regexes. At least to mention that "value" is a regex string, and more helpfully, if an example or two of the regex processing was given.
How can we reproduce it (as minimally and precisely as possible)?
Expected output
Based on the documentation, I'd expect to see the v4.4.1 behavior - PROCESS_ID=process-id:
Actual output
The actual output for v4.5.7 is fine, once you realize regexes are used:
Kustomize version
{Version:kustomize/v4.5.7 GitCommit:56d82a8378dfc8dc3b3b1085e5a6e67b82966bd7 BuildDate:2022-08-02T16:35:54Z GoOs:windows GoArch:amd64}
Operating system
Windows
The text was updated successfully, but these errors were encountered: