-
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
Add failing test for replacements when using an overlay with a namePrefix #4031
Add failing test for replacements when using an overlay with a namePrefix #4031
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Welcome @rjferguson21! |
Hi @rjferguson21. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/test kustomize-presubmit-master Thank you for trying out the new feature :) I THINK this has been addressed in master already (and in v4.2.0) but I am running the tests to confirm. Just as a background for why - the original replacements could only reference objects by their current IDs. Since the prefix transformer runs before the replacement transformer, the replacement looks for the old name and can't find it because it's been prefixed. We addressed this issue by allowing replacements to refer to a resource by any previous ID. It'll be good to just have this test as a regression test I think. EDIT: Never mind - misunderstood the intent of the test. See comment below. |
/ok-to-test |
I took a closer look and this is intended behavior. The replacement happens in the base - at this point the name of the source resource is Other name references are updated (e.g. if a CRB refers to a SA) because kustomize has a hardcoded understanding of where name references occur in kubernetes. It knows that the field ConfigMapKeyRef refers to the name of a ConfigMap, and that an Ingress resource can refer to a Service. This information is built into kustomize. However, this is very difficult for arbitrary replacements. There is no way for the prefix transformer in the overlay to know that the reference in the target's We could potentially store references like this but doing so would be a nontrivial feature request - replacements would have to annotate the resource whenever it gets its source from a resource's GVKNN in such a way that it can keep track of all of these name references. If you would like to see this please file an issue for further discussion, but the current behavior is expected. Again, my suggestion is to move the replacement into the overlay if possible. If this is not possible, I would like to know more about your use case. |
Per discussion in the issue, reopened this PR. For this to be merged, please:
Thanks! |
@rjferguson21: This PR has multiple commits, and the default merge method is: merge. 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. |
57d9ca9
to
4deeb7d
Compare
Updated this with additional tests utilizing I've also added an additional test that we presume to be related utilizing a |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: natasha41575, rjferguson21 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When using an simple overlay with a namePrefix on a base that contains replacements the prefix does not end up on the target values.
cc @natasha41575