mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Merge pull request #105009 from harjas27/printer_event_count
kubectl: remove extra +1 for printing event count
This commit is contained in:
commit
ce4958d908
@ -1786,11 +1786,7 @@ func printEvent(obj *api.Event, options printers.GenerateOptions) ([]metav1.Tabl
|
||||
count := obj.Count
|
||||
if obj.Series != nil {
|
||||
lastTimestamp = translateMicroTimestampSince(obj.Series.LastObservedTime)
|
||||
// When a series is created for the first time, its count is set to 1.
|
||||
// However, for a series to be created, there needs to be an isomorphic
|
||||
// singleton event created beforehand. This singleton event is not
|
||||
// counted in the series count which is why one is added here.
|
||||
count = obj.Series.Count + 1
|
||||
count = obj.Series.Count
|
||||
} else if count == 0 {
|
||||
// Singleton events don't have a count set in the new API.
|
||||
count = 1
|
||||
|
@ -222,7 +222,7 @@ func TestPrintEvent(t *testing.T) {
|
||||
FieldPath: "spec.containers{foo}",
|
||||
},
|
||||
Series: &api.EventSeries{
|
||||
Count: 1,
|
||||
Count: 2,
|
||||
LastObservedTime: metav1.MicroTime{Time: time.Now().UTC().AddDate(0, 0, -2)},
|
||||
},
|
||||
Reason: "Event Reason",
|
||||
|
Loading…
Reference in New Issue
Block a user