File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package e2e
2
2
3
3
import (
4
4
"context"
5
+ "strings"
5
6
6
7
authv1 "k8s.io/api/authorization/v1"
7
8
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -149,8 +150,21 @@ func (t *testCase) expandResourceAttributes() []authv1.ResourceAttributes {
149
150
for _ , resource := range t .data .resources {
150
151
for _ , ra := range ras {
151
152
copy := ra
152
- // TODO: handle group/resource/subresource combination
153
- copy .Resource = resource
153
+ // split the resource string to get the group, resource and subresource
154
+ parts := strings .Split (resource , "/" )
155
+ if len (parts ) > 1 {
156
+ switch len (parts ) {
157
+ case 2 :
158
+ copy .Group = parts [0 ]
159
+ copy .Resource = parts [1 ]
160
+ case 3 :
161
+ copy .Group = parts [0 ]
162
+ copy .Resource = parts [1 ]
163
+ copy .Subresource = parts [2 ]
164
+ }
165
+ } else {
166
+ copy .Resource = parts [0 ]
167
+ }
154
168
resourceExpansions = append (resourceExpansions , copy )
155
169
}
156
170
}
You can’t perform that action at this time.
0 commit comments