-
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
Events corev1: adding eventTime initialization #80222
Conversation
Corev1 event creation for a reference: kubernetes/staging/src/k8s.io/client-go/tools/record/event.go Lines 334 to 347 in 0791f5b
|
Type: eventtype, | ||
DeprecatedFirstTimestamp: t, | ||
DeprecatedLastTimestamp: t, | ||
DeprecatedCount: 1, |
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'm far from being convinced this is exactly what we want.
- We should probably change conversion to convert between deprecated_last_time <-> eventTime
ahh - we can't do that easily because of different types, I need to think about it a bit more.. - DeprecatedCount - we shouldn't populate it, because it will get outdated later
- FirstTimestamp - maybe, but I need to think about it more...
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 agree mostly agree. we need to change conversion
- we should do it anyway I think
- maybe should be converted from EventSeries count
- either from creationTimestamp or maybe set it until we drop these fields
is this change related to #80212 ?
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.
s this change related to #80212 ?
It's not.
After thinking a bit more, I'm not even sure the conversions are broken.
@krzysied - to fix your problem, we should simply start propagating EventTime field in the old events library too:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/tools/record/event.go#L343
and switch to using EventTime field instead of FirstEventTimestamp.
Re DeprecatedLasttimestamp and DeprecatedCount, I wouldn't touch it for now.
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.
Done. I added EventTime initialization to corev1 and removed previous changed.
47e4898
to
59ba15c
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: krzysied The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -340,6 +340,7 @@ func (recorder *recorderImpl) makeEvent(ref *v1.ObjectReference, annotations map | |||
InvolvedObject: *ref, | |||
Reason: reason, | |||
Message: message, | |||
EventTime: (metav1.MicroTime)(t), |
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.
Requires changing unit tests too.
43919fe
to
05588dd
Compare
05588dd
to
67e1974
Compare
/test pull-kubernetes-integration |
@krzysied: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
After digging into k8s code I found out that EventTime being set or not is a differentiation between old and new events. My assumption that EventTime shoud be always set was incorrect then... kubernetes/pkg/apis/core/validation/events.go Lines 42 to 43 in b5dfcf3
I'm closing the PR |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Initialized deprecated fields for the correctness purpose.
Which issue(s) this PR fixes:
Fixes #80219
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: