⚠️ Fakeclient: Reject Delete with mismatched ResourceVersion by 2uasimojo · Pull Request #1582 · kubernetes-sigs/controller-runtime (original) (raw)

Delete takes optional varargs comprising DeleteOptions. Previously fakeclient was validating that these could be run through ApplyOptions, but otherwise ignoring them.

With this commit, fakeclient will observe a DeleteOption specifying a Precondition.ResourceVersion, rejecting the deletion if the value does not match what's on the "server", bringing fakeclient's behavior more in line with a real client.

Note that, while technically a breaking change, any test that was relying on the previous behavior was already broken.

xref #832 / 25ef372 which did something similar for Create and Update. Major difference being that those methods do ResourceVersion matching by default, whereas Delete only does it if opted in via the Precondition.

/assign @vincepri
/assign @mengqiy
/cc @alvaroaleman
/cc @djzager