-
Notifications
You must be signed in to change notification settings - Fork 1.2k
⚠️ Fakeclient: Reject Delete with mismatched ResourceVersion #1582
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: Reject Delete with mismatched ResourceVersion #1582
Conversation
Welcome @2uasimojo! |
Hi @2uasimojo. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
`Delete` takes optional varargs comprising `DeleteOption`s. 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`.
/test pull-controller-runtime-test-master |
1 similar comment
/test pull-controller-runtime-test-master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2uasimojo, alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The resource version is now required: kubernetes-sigs/controller-runtime#1582 ("Fakeclient: Reject Delete with mismatched ResourceVersion").
And fix broken unit tests: - elasticsearch/driver.TestUpgradePodsDeletion_WithNodeTypeMutations - elasticsearch/driver.TestUpgradePodsDeletion_Delete - enterprisesearch.TestReconcileEnterpriseSearch_doReconcile_AssociationDelaysVersionUpgrade - license/trial.TestReconcileTrials_Reconcile/valid_trial_secret_inits_trial With: - Set resource version in newTestPod - Do not reuse the same variable to get trial/license secrets - Always SetAssociationConf before doReconcile Because of: - Client: Ensure no stale data remains in target object kubernetes-sigs/controller-runtime#1640 - Fakeclient: Reject Delete with mismatched ResourceVersion kubernetes-sigs/controller-runtime#1582
And fix broken unit tests: - elasticsearch/driver.TestUpgradePodsDeletion_WithNodeTypeMutations - elasticsearch/driver.TestUpgradePodsDeletion_Delete - enterprisesearch.TestReconcileEnterpriseSearch_doReconcile_AssociationDelaysVersionUpgrade - license/trial.TestReconcileTrials_Reconcile/valid_trial_secret_inits_trial With: - Set resource version in newTestPod - Do not reuse the same variable to get trial/license secrets - Always SetAssociationConf before doReconcile Because of: - Client: Ensure no stale data remains in target object kubernetes-sigs/controller-runtime#1640 - Fakeclient: Reject Delete with mismatched ResourceVersion kubernetes-sigs/controller-runtime#1582
Delete
takes optional varargs comprisingDeleteOption
s. Previously fakeclient was validating that these could be run throughApplyOptions
, but otherwise ignoring them.With this commit, fakeclient will observe a
DeleteOption
specifying aPrecondition.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
andUpdate
. Major difference being that those methods doResourceVersion
matching by default, whereasDelete
only does it if opted in via thePrecondition
./assign @vincepri
/assign @mengqiy
/cc @alvaroaleman
/cc @djzager