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

🐛 Fakeclient: Allow concurrent patching if RV is unset or null #2979

Closed

Commits on Oct 12, 2024

  1. 🐛 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.
    alvaroaleman committed Oct 12, 2024
    Configuration menu
    Copy the full SHA
    ec8ecf9 View commit details
    Browse the repository at this point in the history