Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 allow fakeclient to patch CR with no RV
\# Context This PR should fix a bug kubernetes-sigs#2678 where patching a resource would throw a conflict error when the new object doesn't specify any RV. - Because the new RV is an null, an error is thrown here: https://github.com/kubernetes-sigs/controller-runtime/blob/01de80b092778fd35abd9e2371d54ce0953d4613/pkg/client/fake/client.go#L429-L430 - The RV is nil, because the computed patch between the old and new accessor doesn't include resourceVersion: - https://github.com/evanphx/json-patch/blob/v5.9.0/v5/merge.go#L253-L273 - Witch is used by `client.MergeFrom()`: https://github.com/kubernetes-sigs/controller-runtime/blob/v0.17.2/pkg/client/patch.go#L150-L152 \# Changes - Fix patch by setting the new accessors' RV to the old accessors' RV. - Add test to ensure the correct behavior
- Loading branch information