Skip to content

Commit 8604dec

Browse files
committed
test/framework: GetCAPIResources should warn on rbac issues
In restricted environments some resources might not be available for retrieval; ensure to print a warning but not fail the operation. Signed-off-by: Vince Prignano <vince@prigna.com>
1 parent c1c8833 commit 8604dec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/framework/alltypes_helpers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ func GetCAPIResources(ctx context.Context, input GetCAPIResourcesInput) []*unstr
6969
if apierrors.IsNotFound(err) {
7070
continue
7171
}
72+
if apierrors.IsForbidden(err) {
73+
fmt.Printf("Warning: failed to list %s resources due to a rbac issue: %v", typeList.GroupVersionKind(), err)
74+
continue
75+
}
7276
Fail(fmt.Sprintf("failed to list %q resources: %v", typeList.GroupVersionKind(), err))
7377
}
7478
for i := range typeList.Items {

0 commit comments

Comments
 (0)