-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Delete: needs more preconditions #73648
Comments
@lavalamp I'd like to work on this issue. |
@ajatprabha Go for it! |
Are we saying that , if I get an object, store its resourceVersion and then issue a delete on the resourceVersion for that object , even though the object has been modified and hence its resourceVersion changed, the delete still succeeds ? |
@krmayankk I think there is no RV based precondition check on delete. Only UID based check is there. kubernetes/staging/src/k8s.io/apiserver/pkg/registry/rest/delete.go Lines 79 to 82 in 0c2613c
I'm a little confused when you say issue a delete on resourceVersion for that object . Do you mean like delete the object with old stored RV? In that case, I think currently the delete succeeds as I can't find a check.
|
RV precondition: only delete the object if its current RV equals the specified one. Generation precondition: only delete the object if its current metadata.Generation equals the specified one. Either one works, the generation one is more tolerant of random status updates. There's possibly room in the world for both. @deads2k might have an opinion? If we're going to have more than 2 or three of these things we probably need to make a general mechanism :/ But I think people can use RV or Generation preconditions to stand in for an arbitrary check, so if anything deserves a top level precondition, it'd be those. |
Thanks, @ajatprabha! |
This is good to know, I thought the RV based update/delete worked and would always result in conflict if RV changed. I wonder where do these kinds of changes get documented . May be worth an entry in the api conventions doc? |
Today you can use UID as a precondition for delete; this allows you to avoid deleting an object that has been replaced with an object of the same name.
As reported by @fasaxc on slack, there's also a need to ensure a delete fails if an unobserved change happens to an object. This could be implemented as either an RV or a Generation precondition.
Scenario:
/sig api-machinery
The text was updated successfully, but these errors were encountered: