From e0355d39c3953b1fd75abb4326a87c1466b556bf Mon Sep 17 00:00:00 2001 From: mwdomino Date: Tue, 4 Feb 2025 13:39:31 -0500 Subject: [PATCH] add context.Context to EnqueuRequestsFromMapFunc The underlying `TypedMapFunc` requires this argument, reference https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/handler/enqueue_mapped.go#L36 --- .../src/reference/watching-resources/predicates-with-watch.md | 2 +- .../watching-resources/secondary-resources-not-owned.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/book/src/reference/watching-resources/predicates-with-watch.md b/docs/book/src/reference/watching-resources/predicates-with-watch.md index 129e2069d1d..af9245525ea 100644 --- a/docs/book/src/reference/watching-resources/predicates-with-watch.md +++ b/docs/book/src/reference/watching-resources/predicates-with-watch.md @@ -88,7 +88,7 @@ func (r *BackupBusyboxReconciler) SetupWithManager(mgr ctrl.Manager) error { For(&examplecomv1alpha1.BackupBusybox{}). // Watch the primary resource (BackupBusybox) Watches( &source.Kind{Type: &examplecomv1alpha1.Busybox{}}, // Watch the Busybox CR - handler.EnqueueRequestsFromMapFunc(func(obj client.Object) []reconcile.Request { + handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request { return []reconcile.Request{ { NamespacedName: types.NamespacedName{ diff --git a/docs/book/src/reference/watching-resources/secondary-resources-not-owned.md b/docs/book/src/reference/watching-resources/secondary-resources-not-owned.md index d6d0e238bcb..d92af1472ce 100644 --- a/docs/book/src/reference/watching-resources/secondary-resources-not-owned.md +++ b/docs/book/src/reference/watching-resources/secondary-resources-not-owned.md @@ -40,7 +40,7 @@ func (r *BackupBusyboxReconciler) SetupWithManager(mgr ctrl.Manager) error { For(&examplecomv1alpha1.BackupBusybox{}). // Watch the primary resource (BackupBusybox) Watches( &source.Kind{Type: &examplecomv1alpha1.Busybox{}}, // Watch the Busybox CR - handler.EnqueueRequestsFromMapFunc(func(obj client.Object) []reconcile.Request { + handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request { // Trigger reconciliation for the BackupBusybox in the same namespace return []reconcile.Request{ { @@ -67,7 +67,7 @@ func (r *BackupBusyboxReconciler) SetupWithManager(mgr ctrl.Manager) error { For(&examplecomv1alpha1.BackupBusybox{}). // Watch the primary resource (BackupBusybox) Watches( &source.Kind{Type: &examplecomv1alpha1.Busybox{}}, // Watch the Busybox CR - handler.EnqueueRequestsFromMapFunc(func(obj client.Object) []reconcile.Request { + handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request { // Check if the Busybox resource has the label 'backup-needed: "true"' if val, ok := obj.GetLabels()["backup-enable"]; ok && val == "true" { // If the label is present and set to "true", trigger reconciliation for BackupBusybox