mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-09-19 14:34:27 +00:00
Sort idpcache keys to make things as deterministic as possible.
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
@@ -7,6 +7,7 @@ package idpcache
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"k8s.io/apiserver/pkg/authentication/authenticator"
|
||||
@@ -68,6 +69,14 @@ func (c *Cache) Keys() []Key {
|
||||
result = append(result, key.(Key))
|
||||
return true
|
||||
})
|
||||
|
||||
// Sort the results for consistency.
|
||||
sort.Slice(result, func(i, j int) bool {
|
||||
return result[i].APIGroup < result[j].APIGroup ||
|
||||
result[i].Kind < result[j].Kind ||
|
||||
result[i].Namespace < result[j].Namespace ||
|
||||
result[i].Name < result[j].Name
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user