Skip to content

Commit

Permalink
test/framework: GetCAPIResources should warn on rbac issues
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vincepri committed Sep 19, 2024
1 parent c1c8833 commit 8604dec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/framework/alltypes_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func GetCAPIResources(ctx context.Context, input GetCAPIResourcesInput) []*unstr
if apierrors.IsNotFound(err) {
continue
}
if apierrors.IsForbidden(err) {
fmt.Printf("Warning: failed to list %s resources due to a rbac issue: %v", typeList.GroupVersionKind(), err)
continue
}
Fail(fmt.Sprintf("failed to list %q resources: %v", typeList.GroupVersionKind(), err))
}
for i := range typeList.Items {
Expand Down

0 comments on commit 8604dec

Please sign in to comment.