From ae74d539bc3e37b3e69b7bfe59a9acc8cf9954f1 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Fri, 21 Aug 2026 11:26:30 -0500 Subject: [PATCH] fix: name the cluster in the context a network context reconciles in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolveProjectOrCluster falls back to naming a project's own control plane from the cluster the object was read from, because a project plane's namespace carries no upstream-cluster-name label. It reads that name from the context, and this reconciler never put it there — it took ClusterName from the request for the logger only. So the log line said the cluster while the fallback saw nothing, and every project-plane context failed to resolve. NetworkReconciler already does this, which is why networks reconcile against project control planes today and contexts did not. Co-Authored-By: Claude Opus 5 (1M context) --- internal/controller/networkcontext_controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/controller/networkcontext_controller.go b/internal/controller/networkcontext_controller.go index c6bbe1ae..6c09960a 100644 --- a/internal/controller/networkcontext_controller.go +++ b/internal/controller/networkcontext_controller.go @@ -17,6 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" mcbuilder "sigs.k8s.io/multicluster-runtime/pkg/builder" + mccontext "sigs.k8s.io/multicluster-runtime/pkg/context" mcmanager "sigs.k8s.io/multicluster-runtime/pkg/manager" mcreconcile "sigs.k8s.io/multicluster-runtime/pkg/reconcile" @@ -61,6 +62,9 @@ func (r *NetworkContextReconciler) Reconcile(ctx context.Context, req mcreconcil return ctrl.Result{}, err } + // resolveProjectOrCluster names a project's own control plane from the cluster. + ctx = mccontext.WithCluster(ctx, req.ClusterName) + var networkContext networkingv1alpha.NetworkContext if err := cl.GetClient().Get(ctx, req.NamespacedName, &networkContext); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err)