Sort ingresses by creation timestamp
This commit is contained in:
parent
cac694ecce
commit
b2fa243b97
3 changed files with 29 additions and 9 deletions
|
|
@ -21,6 +21,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"reflect"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -736,6 +737,13 @@ func (s *k8sStore) ListIngresses() []*ingress.Ingress {
|
|||
ingresses = append(ingresses, ing)
|
||||
}
|
||||
|
||||
// sort Ingresses using the CreationTimestamp field
|
||||
sort.SliceStable(ingresses, func(i, j int) bool {
|
||||
ir := ingresses[i].CreationTimestamp
|
||||
jr := ingresses[j].CreationTimestamp
|
||||
return ir.Before(&jr)
|
||||
})
|
||||
|
||||
return ingresses
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue