From 11d3d48431a51de5ea42b4cc66890eb63cdb8317 Mon Sep 17 00:00:00 2001 From: Henry Hrvoje Tonkovac Date: Sun, 23 Aug 2026 04:13:39 +0200 Subject: [PATCH] fix(controller): watch Connection to clear stale TemporalConnection status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DeprecatedTCReconciler only watched TemporalConnection. It decides its status by looking up whether a same-named Connection exists, but nothing outside the reconciler ever writes to a TemporalConnection, so creating the Connection did not enqueue it and the status stayed stale — still telling users to create a Connection that already existed. Watch Connection so the replacement enqueues the deprecated resource. Names are 1:1, so EnqueueRequestForObject maps it directly. No RBAC change is needed: the reconciler already declares get;list;watch on connections. Co-Authored-By: Claude Opus 5 --- internal/controller/deprecated_tc_reconciler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/controller/deprecated_tc_reconciler.go b/internal/controller/deprecated_tc_reconciler.go index 8e554e70..cd09ec71 100644 --- a/internal/controller/deprecated_tc_reconciler.go +++ b/internal/controller/deprecated_tc_reconciler.go @@ -9,6 +9,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + "sigs.k8s.io/controller-runtime/pkg/handler" ) // +kubebuilder:rbac:groups=temporal.io,resources=temporalconnections,verbs=get;list;watch;update;patch @@ -110,6 +111,11 @@ func (r *DeprecatedTCReconciler) Reconcile(ctx context.Context, req ctrl.Request func (r *DeprecatedTCReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&temporaliov1alpha1.TemporalConnection{}). + // A Connection is the replacement for the same-named TemporalConnection, + // so creating one changes the deprecated resource's status. Without this + // watch that status stays stale until an unrelated event happens to + // trigger a reconcile. + Watches(&temporaliov1alpha1.Connection{}, &handler.EnqueueRequestForObject{}). Named("deprecated-tc"). Complete(r) }