-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Ignore changes to creation timestamp from clients on update #5185
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,7 +219,10 @@ func ValidateObjectMetaUpdate(old, meta *api.ObjectMeta) errs.ValidationErrorLis | |
if len(meta.UID) == 0 { | ||
meta.UID = old.UID | ||
} | ||
if meta.CreationTimestamp.IsZero() { | ||
// ignore changes to timestamp | ||
if old.CreationTimestamp.IsZero() { | ||
old.CreationTimestamp = meta.CreationTimestamp | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. meta has to have the same creation timestamp as the new one, otherwise the latter check fails. The problem here is both are set, and are different. This is just about ensuring that "meta" (what we are going to write) is correctly set to something. If old.CreationTimestamp is zero, it seems strictly better to have it set to something (vs remaining empty) |
||
meta.CreationTimestamp = old.CreationTimestamp | ||
} | ||
|
||
|
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.
In what cases would we expect it to be changed to something different, as opposed to just being empty?
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.
Probably none. I don't have the right "reset this value before ValidateUpdate is invoked" so the validator does the reset.
I suppose if no one ever set a creation timestamp (very old clusters), on an update having a value set is better than no value.
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.
I will remove all of this reset code when I implement BeforeUpdate()