Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/observe: stop sorting reserved identity names #798

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions cmd/observe/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,17 @@
package observe

import (
"sort"

"github.com/cilium/cilium/pkg/identity"
)

// reservedIdentitiesNames returns a slice of all the reserved identity
// strings.
func reservedIdentitiesNames() []string {
identities := identity.GetAllReservedIdentities()
// NOTE: identity.GetAllReservedIdentities() returned values are sorted in
// a random order due to be sourced from a map. We sort them here in
// identity order to ensure consistency before converting them to strings.
// Once https://github.com/cilium/cilium/pull/20048 is merged and vendored,
// we can remove this sort.
sort.Slice(identities, func(i, j int) bool {
return identities[i].Uint32() < identities[j].Uint32()
})

names := make([]string, len(identities))
for i, id := range identities {
names[i] = id.String()
}

return names
}

Expand Down