Skip to content

Commit

Permalink
Fix trying to list cluster-level resources
Browse files Browse the repository at this point in the history
when namespace specified

close #984
  • Loading branch information
mikutas committed Oct 22, 2023
1 parent 9768776 commit 720cbc0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kube/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ func CreateResourceProviderFromAPI(ctx context.Context, kube kubernetes.Interfac
logrus.Warnf("Error retrieving mapping of Kind %s because of error: %v", kind, err)
return nil, err
}
if c.Namespace != "" && mapping.Scope.Name() != meta.RESTScopeNameNamespace {
logrus.Infof("Skipping %s because of auditing specific namespace", mapping.GroupVersionKind)
continue
}

logrus.Info("Loading " + kind)
objects, err := dynamic.Resource(mapping.Resource).Namespace(c.Namespace).List(ctx, metav1.ListOptions{})
Expand Down

0 comments on commit 720cbc0

Please sign in to comment.