Skip to content

fix(karpenter): fix Age column sort in event lists - #1213

Open
magic-peach wants to merge 1 commit into
headlamp-k8s:mainfrom
magic-peach:fix/karpenter-event-age-sort
Open

fix(karpenter): fix Age column sort in event lists#1213
magic-peach wants to merge 1 commit into
headlamp-k8s:mainfrom
magic-peach:fix/karpenter-event-age-sort

Conversation

@magic-peach

Copy link
Copy Markdown

The Age column's sort comparator reads n1.lastTimestamp / n2.lastTimestamp straight off the event objects. Event doesn't expose that as a public property though, only internally via getValue('lastTimestamp'), so both sides come back undefined and new Date(undefined).getTime() is NaN every time. The comparator always returns NaN, so clicking the Age header never actually reorders anything.

Switched to lastOccurrence, which is the getter the same column already uses to render what it shows the user. It also handles EventSeries correctly (falls back to series.lastObservedTime), which lastTimestamp doesn't — that's the normal shape for karpenter's own repeated scaling/consolidation events, so this wasn't just an edge case.

Pulled the comparator out into its own exported function so it's testable without needing a live Event instance.

The sort comparator read n1.lastTimestamp/n2.lastTimestamp directly,
but Event only exposes that field through an internal getValue() call,
not as a public property, so both sides were always undefined and the
comparator always returned NaN. Clicking the Age header did nothing.

Switched to lastOccurrence, the getter the column already uses to
render the displayed age, which also correctly falls back to
series.lastObservedTime for EventSeries-based repeated events (the
common case for karpenter's own scaling/consolidation events).

Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant