Skip to content

Commit 75f8eb9

Browse files
committed
fix: ProviderConfig reconciler to filter usages by namespace
Signed-off-by: Konstantin Plis <plis.konstantin@gmail.com>
1 parent 8fa945b commit 75f8eb9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/reconciler/providerconfig/reconciler.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco
178178
matchingLabels[xpv1.LabelKeyProviderKind] = pc.GetObjectKind().GroupVersionKind().Kind
179179
}
180180

181-
if err := r.client.List(ctx, l, matchingLabels); err != nil {
181+
listOpts := []client.ListOption{matchingLabels}
182+
if pc.GetNamespace() != "" {
183+
listOpts = append(listOpts, client.InNamespace(pc.GetNamespace()))
184+
}
185+
186+
if err := r.client.List(ctx, l, listOpts...); err != nil {
182187
log.Debug(errListPCUs, "error", err)
183188
r.record.Event(pc, event.Warning(reasonAccount, errors.Wrap(err, errListPCUs)))
184189

0 commit comments

Comments
 (0)