From 22b4a6dfcb86f1e74d3f1f09f5674a7e56b4df75 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Tue, 5 Oct 2021 13:27:50 +0200 Subject: [PATCH] ClusterToObjectsMapper: use namespace in client.List MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- util/util.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util/util.go b/util/util.go index 3b624ab624c9..b96f7b64ef0c 100644 --- a/util/util.go +++ b/util/util.go @@ -501,7 +501,14 @@ func ClusterToObjectsMapper(c client.Client, ro runtime.Object, scheme *runtime. list := &unstructured.UnstructuredList{} list.SetGroupVersionKind(gvk) - if err := c.List(context.TODO(), list, client.MatchingLabels{clusterv1.ClusterLabelName: cluster.Name}); err != nil { + if err := c.List( + context.TODO(), + list, + client.InNamespace(cluster.Namespace), + client.MatchingLabels{ + clusterv1.ClusterLabelName: cluster.Name, + }, + ); err != nil { return nil }