Skip to content
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

Patch conflation shouldn't use patching to merge patches #3394

Closed
monopole opened this issue Dec 26, 2020 · 1 comment · Fixed by #3727
Closed

Patch conflation shouldn't use patching to merge patches #3394

monopole opened this issue Dec 26, 2020 · 1 comment · Fixed by #3727

Comments

@monopole
Copy link
Contributor

monopole commented Dec 26, 2020

Under kyaml, the patch conflict detector and merging mechanism
https://github.com/kubernetes-sigs/kustomize/blob/master/api/resmap/merginator.go#L76
uses a patching approach rather than an object merge approach.

I.e., to conflate N patches, the second patch is applied to the first patch,
and the third patch is applied to that, etc. instead of merging the fields without
treating them as patching each other.

This results in a problem when two or more patches are applied at the same level to
the same object. Not a frequent use case, but it can happen and we have a test
covering it in

api/krusty/multiplepatch_test.go: TestRemoveEmptyDirWithPatchesAtSameLevel

An attempt to use a patch to drop the volume emptyDir {} field by
patching it with emptyDir null works when used in a single patch, but
fails in a multi-patch context because the null field is dropped in the
patch conflation.

Possibly related: #2037

monopole added a commit to monopole/kustomize that referenced this issue Dec 26, 2020
@monopole monopole changed the title Patch conflation code path under kyaml shouldn't use patching to merge patches Patch conflation shouldn't use patching to merge patches Dec 26, 2020
natasha41575 pushed a commit to natasha41575/kustomize that referenced this issue Jan 13, 2021
@monopole
Copy link
Contributor Author

monopole added a commit to monopole/kustomize that referenced this issue Mar 14, 2021
monopole added a commit to monopole/kustomize that referenced this issue Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant