Skip to content

Commit 67d355d

Browse files
authored
Merge pull request #2613 from samuelvl/0.16-perf-client-matching-labels
[release-0.16] 🏃 Make client.MatchingLabels faster
2 parents 5f8d96b + ab7cf07 commit 67d355d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/client/options.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ type MatchingLabels map[string]string
514514
func (m MatchingLabels) ApplyToList(opts *ListOptions) {
515515
// TODO(directxman12): can we avoid reserializing this over and over?
516516
if opts.LabelSelector == nil {
517-
opts.LabelSelector = labels.NewSelector()
517+
opts.LabelSelector = labels.SelectorFromValidatedSet(map[string]string(m))
518+
return
518519
}
519520
// If there's already a selector, we need to AND the two together.
520521
noValidSel := labels.SelectorFromValidatedSet(map[string]string(m))

0 commit comments

Comments
 (0)