Skip to content

Commit

Permalink
Merge pull request #2613 from samuelvl/0.16-perf-client-matching-labels
Browse files Browse the repository at this point in the history
[release-0.16] 🏃 Make client.MatchingLabels faster
  • Loading branch information
k8s-ci-robot committed Dec 8, 2023
2 parents 5f8d96b + ab7cf07 commit 67d355d
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 67d355d

Please sign in to comment.