Skip to content

Commit e0355d3

Browse files
committed
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
1 parent 6a2525c commit e0355d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/book/src/reference/watching-resources/predicates-with-watch.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (r *BackupBusyboxReconciler) SetupWithManager(mgr ctrl.Manager) error {
8888
For(&examplecomv1alpha1.BackupBusybox{}). // Watch the primary resource (BackupBusybox)
8989
Watches(
9090
&source.Kind{Type: &examplecomv1alpha1.Busybox{}}, // Watch the Busybox CR
91-
handler.EnqueueRequestsFromMapFunc(func(obj client.Object) []reconcile.Request {
91+
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request {
9292
return []reconcile.Request{
9393
{
9494
NamespacedName: types.NamespacedName{

docs/book/src/reference/watching-resources/secondary-resources-not-owned.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (r *BackupBusyboxReconciler) SetupWithManager(mgr ctrl.Manager) error {
4040
For(&examplecomv1alpha1.BackupBusybox{}). // Watch the primary resource (BackupBusybox)
4141
Watches(
4242
&source.Kind{Type: &examplecomv1alpha1.Busybox{}}, // Watch the Busybox CR
43-
handler.EnqueueRequestsFromMapFunc(func(obj client.Object) []reconcile.Request {
43+
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request {
4444
// Trigger reconciliation for the BackupBusybox in the same namespace
4545
return []reconcile.Request{
4646
{
@@ -67,7 +67,7 @@ func (r *BackupBusyboxReconciler) SetupWithManager(mgr ctrl.Manager) error {
6767
For(&examplecomv1alpha1.BackupBusybox{}). // Watch the primary resource (BackupBusybox)
6868
Watches(
6969
&source.Kind{Type: &examplecomv1alpha1.Busybox{}}, // Watch the Busybox CR
70-
handler.EnqueueRequestsFromMapFunc(func(obj client.Object) []reconcile.Request {
70+
handler.EnqueueRequestsFromMapFunc(func(ctx context.Context, obj client.Object) []reconcile.Request {
7171
// Check if the Busybox resource has the label 'backup-needed: "true"'
7272
if val, ok := obj.GetLabels()["backup-enable"]; ok && val == "true" {
7373
// If the label is present and set to "true", trigger reconciliation for BackupBusybox

0 commit comments

Comments
 (0)