Skip to content

Commit

Permalink
Merge pull request #2614 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2529-to-release-0.15

[release-0.15] 🏃 Make client.MatchingLabels faster
  • Loading branch information
k8s-ci-robot committed Dec 8, 2023
2 parents 9a0ec0f + f0320e6 commit 735b607
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/client/options.go
Original file line number Diff line number Diff line change
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 735b607

Please sign in to comment.