-
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
Regex support in ReplacementTransformer broken. #5128
Comments
I'm facing very similar issues in my projects. If behavior will not be recovered then I will have to rewrite a lot of Kustomize specs I'm using now :( |
Similar, but different, with 4.x to 5.x I'm seeing,
for a
|
/assign |
I am also experiencing this issue with replacements. The previous behavior on This is the the config that I am using. source:
kind: ConfigMap
name: my-config-map
fieldPath: data.my-field
targets:
- select:
apiVersion: storage.k8s.io
kind: StorageClass
fieldPaths:
- parameters.network
options:
create: false IF the following exists, then the replacement works. apiVersion: storage.k8s.io/v1
kind: StorageClase
metadata:
name: my-storage-class
parameters:
network: <REPLACE_ME> But if the resource does not contain
|
The regex issue is interesting and I will try to find time to think about it. But -
That was an intentional change that we announced in the release notes. Because it was intentional and released with a major bump, I don't think we would consider that an issue or a regression. |
@natasha41575 any thoughts about what I ran across, which wasn't using a regex, but had the same error as originally reported? |
I'm having the same issue as @m-trojanowski with replacements no longer working after |
@natasha41575 |
This comment was marked as resolved.
This comment was marked as resolved.
Preserving code from kubernetes-sigs#5221 for investigation and future improvements to resolve kubernetes-sigs#5128
Hi @natasha41575. I am facing the same issues with the new It would be great to have an option/flag to allow using the previous behavior for specific replacements. |
Hi @natasha41575, |
I'm experiencing this regex issue with kustomize 5.1.0. Would love to see it fixed. |
Hey any update on this @natasha41575? |
May there should be an additional option continueOnFailure: true or skip: true which covers the case that there are possible replacement targets which don't have and don't need the value. I'm heavily using the labelSelector to not manage all resource by name. Unfortunatly I'm now forced to manage the restrict list with the resource which are failiing currently |
Hi @natasha41575 , |
I second this. As currently the 5.x versions rendered my whole project useless. Components may share certain parameters, or a parameter may be used by only one component. The parameters are provided by a key-value-template and are being replaced with replacements blocks. This mechanism is now completely broken and I will have to rewrite the whole thing and use rejects like crazy or split up the project into hundreds of small files which will result in a complete mess. @m-trojanowski thanks for your proposal I hope it will be taken into consideration |
@KlausMandola as I have very similar issue in my projects right now I'm planning to migrate Kustomize to Jsonnet. It should be not very complicated as yaml can be easily transformed to json and the simplest use of Jsonnet is about to use just json files. |
Include a kustomize_4 build, since v5 introduced breaking changes (kubernetes-sigs/kustomize#5128)
Include a kustomize_4 build, since v5 introduced breaking changes (kubernetes-sigs/kustomize#5128)
Include a kustomize_4 build, since v5 introduced breaking changes (kubernetes-sigs/kustomize#5128)
Include a kustomize_4 build, since v5 introduced breaking changes (kubernetes-sigs/kustomize#5128)
We are also badly affected by this change (see my other comment on the PR) I have opened a formal feature request for allowing users to opt for the pre-5.0.0 behavior with a flag : #5440 |
@renaudguerin please take a look also on this PR #5280 which should also resolve this issue but for some reason nobody is willing to review it :( |
Include a kustomize_4 build, since v5 introduced breaking changes (kubernetes-sigs/kustomize#5128)
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 |
/remove-lifecycle stale |
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 |
/remove-lifecycle stale |
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 |
/remove-lifecycle stale |
What happened?
Hello,
Up to kustomize version 4.5.7 I was able to use
ReplacementTransformer
to actually find kinds based on regexes insidefieldPaths
field like so:Here I'm searching for all StatefulSet and Deployment containers with name that starts with
myservice-*
and replace it's image tag with data from "myservice-config"
ConfigMap
. To do so I'm splitting imagefieldPath
result using delimeter:
and picking tag part of string usingindex: 1
option.This is no longer possible since version 5.0.0 and I believe I found code that is responsible for this change:
https://github.com/kubernetes-sigs/kustomize/blob/master/api/filters/replacement/replacement.go#L196
This prevents any kind of searches using regexes.
What did you expect to happen?
I expected to actually render kubernetes manifests.
Instead all I get is the following error:
How can we reproduce it (as minimally and precisely as possible)?
components/myservice-version/kustomization.yaml
:environments/dev/kustomization.yaml
:environments/dev/overlay/kustomization.yaml
:environments/dev/overlay/config.properties
:MYSERVICE_VERSION=n1287
myserviceap/kustomization.yaml
:myserviceap/resources.yaml
:Expected output
kustomize version {Version:kustomize/v4.5.7 GitCommit:56d82a8378dfc8dc3b3b1085e5a6e67b82966bd7 BuildDate:2022-08-02T16:35:54Z GoOs:linux GoArch:amd64}
kustomize build --enable-helm environments/dev
Actual output
kustomize version v5.0.1
kustomize build --enable-helm environments/dev
Kustomize version
v5.0.1
Operating system
None
The text was updated successfully, but these errors were encountered: