Skip to content

Commit

Permalink
Merge pull request #2529 from kubernetes-sigs/speed-up
Browse files Browse the repository at this point in the history
🏃 Make client.MatchingLabels faster
  • Loading branch information
k8s-ci-robot committed Oct 9, 2023
2 parents 968daa8 + cb5be1f commit 8ac8b9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/client/options.go
Expand Up @@ -514,7 +514,8 @@ type MatchingLabels map[string]string
func (m MatchingLabels) ApplyToList(opts *ListOptions) {
// TODO(directxman12): can we avoid reserializing this over and over?
if opts.LabelSelector == nil {
opts.LabelSelector = labels.NewSelector()
opts.LabelSelector = labels.SelectorFromValidatedSet(map[string]string(m))
return
}
// If there's already a selector, we need to AND the two together.
noValidSel := labels.SelectorFromValidatedSet(map[string]string(m))
Expand Down

0 comments on commit 8ac8b9f

Please sign in to comment.