You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐛 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.
0 commit comments