From d686f64cfd055d287519f6792eeccf2dfeaf5c4a Mon Sep 17 00:00:00 2001 From: Robert Vasek Date: Tue, 4 Aug 2026 17:15:43 +0200 Subject: [PATCH] Annotate Leases with Connection name On-behalf-of: @SAP robert.vasek@sap.com Signed-off-by: Robert Vasek --- engine/connection/reconciler.go | 1 + sdk/apis/core/v1alpha1/labels.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/engine/connection/reconciler.go b/engine/connection/reconciler.go index f7c543234..5753a62f5 100644 --- a/engine/connection/reconciler.go +++ b/engine/connection/reconciler.go @@ -268,6 +268,7 @@ func (r *Reconciler) heartbeat(ctx context.Context, providerClient client.Client lease.Annotations = map[string]string{} } lease.Annotations[corev1alpha1.AnnotationConsumerClusterUID] = conn.Status.LocalClusterUID + lease.Annotations[corev1alpha1.AnnotationConnection] = conn.Name lease.Spec.HolderIdentity = ptr.To(conn.Status.LocalClusterUID) lease.Spec.LeaseDurationSeconds = ptr.To(int32(leaseDurationSeconds)) if lease.Spec.AcquireTime == nil { diff --git a/sdk/apis/core/v1alpha1/labels.go b/sdk/apis/core/v1alpha1/labels.go index d0f1e7796..5937b7a10 100644 --- a/sdk/apis/core/v1alpha1/labels.go +++ b/sdk/apis/core/v1alpha1/labels.go @@ -27,9 +27,10 @@ const ( // the provider. LabelManaged = "core.kbind.io/managed" - // AnnotationConnection records, on a pulled consumer CRD, the name of the - // Connection whose provider it was pulled from. The sync engine uses it to - // pin the provider cluster for that API. + // AnnotationConnection records the name of the Connection. + // Used on pulled consumer CRD so that the sync engine can pin + // the provider cluster for that API. It's also used on Leases to maintain + // the link between consumer's Connection and provider's Lease. AnnotationConnection = "core.kbind.io/connection" // AnnotationConsumerClusterUID records the consumer cluster identity on a