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

Prevent resourceVersion updates for custom resources on no-op writes #67562

Merged
merged 1 commit into from Aug 21, 2018
Commits on Aug 21, 2018
  1. Prevent resource version to custom resource on no-op writes

    nikhita committed Aug 20, 2018
    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.