Unverified Commit e5b8e891 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #66351 from vikaschoudhary16/fix-scopeselector-exist-operator

Automatic merge from submit-queue (batch tested with PRs 66351, 66883, 66156). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add unit tests to cover scopes and scope selectors during quota sync logic **What this PR does / why we need it**: Adds unit tests to cover scopes and scope selectors fields in the quota spec. Existing unit test for quota sync does not cover scopes. Also while adding tests found a minor issue with 'Exists' scope selector operator. This is also being fixed in this PR. **Special notes for your reviewer**: **Release note**: ```release-note Unit tests for scopes and scope selectors in the quota spec ``` /cc @derekwaynecarr @sjenning @bsalamat @kubernetes/sig-scheduling-pr-reviews @kubernetes/sig-node-pr-reviews
parents a160fe94 c83f18a8
...@@ -380,7 +380,10 @@ func podMatchesSelector(pod *api.Pod, selector api.ScopedResourceSelectorRequire ...@@ -380,7 +380,10 @@ func podMatchesSelector(pod *api.Pod, selector api.ScopedResourceSelectorRequire
if err != nil { if err != nil {
return false, fmt.Errorf("failed to parse and convert selector: %v", err) return false, fmt.Errorf("failed to parse and convert selector: %v", err)
} }
m := map[string]string{string(api.ResourceQuotaScopePriorityClass): pod.Spec.PriorityClassName} var m map[string]string
if len(pod.Spec.PriorityClassName) != 0 {
m = map[string]string{string(api.ResourceQuotaScopePriorityClass): pod.Spec.PriorityClassName}
}
if labelSelector.Matches(labels.Set(m)) { if labelSelector.Matches(labels.Set(m)) {
return true, nil return true, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment