diff --git a/pkg/reconciler/providerconfig/reconciler.go b/pkg/reconciler/providerconfig/reconciler.go index d2d8bf07f..551f795f8 100644 --- a/pkg/reconciler/providerconfig/reconciler.go +++ b/pkg/reconciler/providerconfig/reconciler.go @@ -178,7 +178,12 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco matchingLabels[xpv1.LabelKeyProviderKind] = pc.GetObjectKind().GroupVersionKind().Kind } - if err := r.client.List(ctx, l, matchingLabels); err != nil { + listOpts := []client.ListOption{matchingLabels} + if pc.GetNamespace() != "" { + listOpts = append(listOpts, client.InNamespace(pc.GetNamespace())) + } + + if err := r.client.List(ctx, l, listOpts...); err != nil { log.Debug(errListPCUs, "error", err) r.record.Event(pc, event.Warning(reasonAccount, errors.Wrap(err, errListPCUs)))