Automated cherry pick of #67562: Prevent resourceVersion updates for custom resources on no-op writes#67616
Conversation
|
/uncc @david-mcmahon |
|
Currently, resourceVersion is incremented even for no-op writes for custom resources. This occurs because metadata accessors for Combined with ObjetMeta pruning (which respects Instead of updating the accessors (which could be a breaking change), we are making sure that we don't set the fields in More details in #67562, #67541 (comment). /assign @foxish |
|
/sig api-machinery |
|
/hold |
d06f88e to
854a01d
Compare
|
Updated to reflect changes in #67562. |
|
/lgtm |
For ObjectMeta pruning, we round trip through marshalling and unmarshalling. If the ObjectMeta contained any strings with "" (or other fields with empty values) _and_ the respective fields are omitempty, those fields will be lost in the round trip process. This makes ObjectMeta after the no-op write different from the one before the write. Resource version is incremented every time data is written to etcd. Writes to etcd short-circuit if the bytes being written are identical to the bytes already present. So this ends up incrementing the resourceVersion even on no-op writes. The zero values are set in BeforeCreate and BeforeUpdate. This commit updates BeforeUpdate such that zero values are only set when the object does not have a zero value for the respective field.
854a01d to
4f3bdcd
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, nikhita, sttts The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold cancel |
|
This PR is not for the master branch but does not have the |
|
The labels are messed up because of kubernetes/test-infra#9128. We need a prow bump to fix this. |
|
Closing and opening the PR to trigger prow to remove the |
|
Take 2 now that the plugin is actually enabled. |
|
/reopen |
|
Woohoo! |
|
/test all [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue. |
Cherry pick of #67562 on release-1.11.
#67562: Prevent resourceVersion updates for custom resources on no-op writes