{"push_id":1126670479,"size":2,"distinct_size":2,"ref":"refs/heads/master","head":"5303794ef0fabc1f73b7eaf7447c295e6f5d369a","before":"04d6162e0ff9f0ccc5dbfe9eb495a73669a13ee1","commits":[{"sha":"29252acd1ad80ca492c800713d9bc329282e9ed8","author":{"email":"aa6ef2bbe17379c3e8e7883829f55c5a7ad052b1@redhat.com","name":"Jordan Liggitt"},"message":"Change rest storage Update interface to retrieve updated object\n\nAdd OldObject to admission attributes\n\nUpdate resthandler Patch/Update admission plumbing","distinct":true,"url":"https://api.github.com/repos/kubernetes/kubernetes/commits/29252acd1ad80ca492c800713d9bc329282e9ed8"},{"sha":"5303794ef0fabc1f73b7eaf7447c295e6f5d369a","author":{"email":"efe88cf206bc79cccfc4e4395778b76384b89d96@gmail.com","name":"k8s-merge-robot"},"message":"Merge pull request #25787 from liggitt/update-admission\n\nAutomatic merge from submit-queue\n\nplumb Update resthandler to allow old/new comparisons in admission\n\nRework how updated objects are passed to rest storage Update methods (first pass at https://github.com/kubernetes/kubernetes/pull/23928#discussion_r61444342)\r\n\r\n* allows centralizing precondition checks (uid and resourceVersion)\r\n* allows admission to have the old and new objects on patch/update operations (sets us up for field level authorization, differential quota updates, etc)\r\n* allows patch operations to avoid double-GETting the object to apply the patch\r\n\r\nOverview of important changes:\r\n* pkg/api/rest/rest.go\r\n  * changes `rest.Update` interface to give rest storage an `UpdatedObjectInfo` interface instead of the object directly. To get the updated object, the storage must call `UpdatedObject()`, passing in the current object\r\n* pkg/api/rest/update.go\r\n  * provides a default `UpdatedObjectInfo` impl\r\n  * passes a copy of the updated object through any provided transforming functions and returns it when asked\r\n  * builds UID preconditions from the updated object if they can be extracted\r\n* pkg/apiserver/resthandler.go\r\n  * Reworks update and patch operations to give old objects to admission\r\n* pkg/registry/generic/registry/store.go\r\n  * Calls `UpdatedObject()` inside `GuaranteedUpdate` so it can provide the old object\r\n\r\nTodo:\r\n- [x] Update rest.Update interface:\r\n  * Given the name of the object being updated\r\n  * To get the updated object data, the rest storage must pass the current object (fetched using the name) to an `UpdatedObject(ctx, oldObject) (newObject, error)` func. This is typically done inside a `GuaranteedUpdate` call.\r\n- [x] Add old object to admission attributes interface\r\n- [x] Update resthandler Update to move admission into the UpdatedObject() call\r\n- [x] Update resthandler Patch to move the patch application and admission into the UpdatedObject() call\r\n- [x] Add resttest tests to make sure oldObj is correctly passed to UpdatedObject(), and errors propagate back up\r\n\r\nFollow-up:\r\n* populate oldObject in admission for delete operations?\r\n* update quota plugin to use `GetOldObject()` in admission attributes\r\n* admission plugin to gate ownerReference modification on delete permission\r\n* Decide how to handle preconditions (does that belong in the storage layer or in the resthander layer?)","distinct":true,"url":"https://api.github.com/repos/kubernetes/kubernetes/commits/5303794ef0fabc1f73b7eaf7447c295e6f5d369a"}]}
{"actor":{"display_login":"k8s-merge-robot"}}