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 Nov 3, 2023
1 parent 391b802 commit fbc4eac
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 fbc4eac

Please sign in to comment.