Fix EventSeries starting count discrepancy#112334
Fix EventSeries starting count discrepancy#112334k8s-ci-robot merged 1 commit intokubernetes:masterfrom
Conversation
|
Unknown CLA label state. Rechecking for CLA labels. Send feedback to sig-contributor-experience at kubernetes/community. /check-cla |
|
/lgtm /hold for Jordan review |
|
this needs a test (probably an integration test) that exercises this reporter in a way that would have caught the failure e.g. walk an event through creation, introduction of a series, and incrementing of the series, and verify the resulting event API object gets updated and looks correct at each stage |
|
/lgtm cancel |
|
/triage accepted |
105dff2 to
a12bd72
Compare
There was a problem hiding this comment.
I added an integration test that is failing because it is hitting the data race reported in #92500, I'll send another PR to fix it.
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
/test pull-kubernetes-integration |
The kube-apiserver validation expects the Count of an EventSeries to be at least 2, otherwise it rejects the Event. There was is discrepancy between the client and the server since the client was iniatizing an EventSeries to a count of 1. According to the original KEP, the first event emitted should have an EventSeries set to nil and the second isomorphic event should have an EventSeries with a count of 2. Thus, we should matcht the behavior define by the KEP and update the client. Also, as an effort to make the old clients compatible with the servers, we should allow Events with an EventSeries count of 1 to prevent any unexpected rejections. Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
a12bd72 to
d003649
Compare
|
I'll defer review of the test to @aojea, the client update lgtm |
|
/lgtm Thanks! /hold cancel |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgrisonnet, wojtek-t 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 |
|
LGTM label has been added. DetailsGit tree hash: 17053a94ac2111c582248d2a47337f09d81ee790 |
|
Can we backport this? Do we still have a chance for 1.24? |
What type of PR is this?
/kind bug
What this PR does / why we need it:
The kube-apiserver validation expects the Count of an EventSeries to be at least 2, otherwise, it rejects the Event. There was a discrepancy between the client and the server since the client was initializing an EventSeries to a count of 1.
According to the original KEP, the first event emitted should have an EventSeries set to nil and the second isomorphic event should have an EventSeries with a count of 2. Thus, we should match the behavior defined by the KEP and update the client.
Also, as an effort to make the old clients compatible with the servers, we should allow Events with an EventSeries count of 1 to prevent any unexpected rejections.
Special notes for your reviewer:
I stumbled upon this after finding some weird
Server rejected eventlogs in the kube-scheduler. The error in the logs was in two parts:One is complaining about the series.count value being lower than 2 and the other about the eventTime value. The latter was recently fixed as part of #111928, but the count issue is still present.
Since series.count returning an empty string was a bit weird I looked into the audit logs to see what was the query sent to the apiserver. I found the following patch request body:
Looking at the code, it seems that the empty string was hard coded... https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/events.go#L123
So the actual issue was a discrepancy between the client emitting the event and the server validating it.
Looking at the KEP, it seems that the server is correct: https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/383-new-event-api-ga-graduation#short-examples
Does this PR introduce a user-facing change?
/cc @liggitt