Skip to content

Commit 1a2d911

Browse files
committed
only expand resources when strictly needed
1 parent 769ca7a commit 1a2d911

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/authorization/api/helpers.go

+14
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ import (
1414
)
1515

1616
func ExpandResources(rawResources sets.String) sets.String {
17+
// we only need to expand groups if the exist and we don't create them with groups
18+
// by default. Only accept the cost of expansion if we're doing work.
19+
needsExpansion := false
20+
for rawResource := range rawResources {
21+
if strings.Index(currResource, ResourceGroupPrefix+":") == 0 {
22+
needsExpansion = true
23+
break
24+
}
25+
26+
}
27+
if !needsExpansion {
28+
return rawResources
29+
}
30+
1731
ret := sets.String{}
1832
toVisit := rawResources.List()
1933
visited := sets.String{}

0 commit comments

Comments
 (0)