-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fakeclient: Allow concurrent patching if RV is unset
Currently, the fake client always errors if patches are done concurrently rather than only if the patch contains a ResourceVersion. This is because we have a number of checks including the one related to resourceVersion implemented in a `versionedTracker`. The `versionedTracker` receives the patched object and assumes that the patchedObject only contains a RV if the patch had one. That turns out not to be true, it almost always has one. The reason the object we receive in the `versionedTracker` almost always has a RV is that we use a client-go reactor to apply the patch to an object. The way this works is that the reactor takes the patch and a tracker, fetches the object from the tracker and applies the patch to it. This means that the resulting object always has a resourceVersion unless the patch explicitly set it to `null`. This `null` case apparently is special cased in the Kubernetes apiserver to be acceptable, so we do the same here. Fix the original issue by checking in the fakeclient if the patch modifies the RV and if not, retry conflicts.
- Loading branch information
1 parent
5af6ffa
commit 746f35f
Showing
2 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters