Merge pull request #1713 from kubescape/fixfix

use proper params in pager call
This commit is contained in:
Matthias Bertschy
2024-07-10 12:41:04 +02:00
committed by GitHub

View File

@@ -378,8 +378,8 @@ func (k8sHandler *K8sResourceHandler) pullSingleResource(resource *schema.GroupV
// list resources
if err := pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {
return clientResource.List(context.Background(), opts)
}).EachListItem(context.TODO(), listOptions, func(obj runtime.Object) error {
return clientResource.List(ctx, opts)
}).EachListItem(context.Background(), listOptions, func(obj runtime.Object) error {
uObject := obj.(*unstructured.Unstructured)
if k8sinterface.IsTypeWorkload(uObject.Object) && k8sinterface.WorkloadHasParent(workloadinterface.NewWorkloadObj(uObject.Object)) {
logger.L().Debug("Skipping resource with parent", helpers.String("kind", uObject.GetKind()), helpers.String("name", uObject.GetName()))