Skip to content

Commit

Permalink
remove sorting and let fe do it (#2750)
Browse files Browse the repository at this point in the history
  • Loading branch information
smonero authored Jul 27, 2023
1 parent ed72e5a commit be51d7c
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions backend/service/k8s/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package k8s

import (
"context"
"sort"
"strings"

"github.com/iancoleman/strcase"
Expand Down Expand Up @@ -35,13 +34,6 @@ func (s *svc) ListEvents(ctx context.Context, clientset, cluster, namespace, obj
return events, nil
}

// For ease of use, we can sort the events in reverse chronological order
func sortEventsByLastTime(events []*k8sapiv1.Event) {
sort.Slice(events, func(i, j int) bool {
return events[i].LastTimestampMillis > events[j].LastTimestampMillis
})
}

func ProtoForEvent(cluster string, k8sEvent *corev1.Event) *k8sapiv1.Event {
clusterName := GetKubeClusterName(k8sEvent)
if clusterName == "" {
Expand Down Expand Up @@ -125,9 +117,6 @@ func (s *svc) ListNamespaceEvents(ctx context.Context, clientset, cluster, names
ev := ev
events = append(events, ProtoForEvent(cs.Cluster(), &ev))
}
// Sort in reverse chronological order (by LastTimestampMillis),
// this is needed because we might have multiple types of events
sortEventsByLastTime(events)

return events, nil
}
Expand Down

0 comments on commit be51d7c

Please sign in to comment.