File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
staging/src/k8s.io/client-go/testing Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -439,8 +439,18 @@ func (a ActionImpl) GetSubresource() string {
439
439
return a .Subresource
440
440
}
441
441
func (a ActionImpl ) Matches (verb , resource string ) bool {
442
+ // Stay backwards compatible.
443
+ if ! strings .Contains (resource , "/" ) {
444
+ return strings .EqualFold (verb , a .Verb ) &&
445
+ strings .EqualFold (resource , a .Resource .Resource )
446
+ }
447
+
448
+ parts := strings .SplitN (resource , "/" , 2 )
449
+ topresource , subresource := parts [0 ], parts [1 ]
450
+
442
451
return strings .EqualFold (verb , a .Verb ) &&
443
- strings .EqualFold (resource , a .Resource .Resource )
452
+ strings .EqualFold (topresource , a .Resource .Resource ) &&
453
+ strings .EqualFold (subresource , a .Subresource )
444
454
}
445
455
func (a ActionImpl ) DeepCopy () Action {
446
456
ret := a
You can’t perform that action at this time.
0 commit comments