Skip to content

Commit

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

close #984
  • Loading branch information
mikutas authored Mar 5, 2024
1 parent 1ee4df0 commit 48fc87a
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 @@ -336,6 +336,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 48fc87a

Please sign in to comment.