Skip to content

Commit 6037707

Browse files
committed
Revert WithCancelCause changes
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
1 parent daeceaa commit 6037707

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

pkg/konnector/controllers/cluster/serviceexport/multinsinformer/informer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ func (inf *DynamicMultiNamespaceInformer) enqueueServiceNamespace(obj any) {
187187
}
188188

189189
logger.V(1).Info("starting dynamic informer", "namespace", sns.Status.Namespace)
190-
ctx, cancel := context.WithCancelCause(context.Background())
190+
ctx, cancel := context.WithCancel(context.Background()) //nolint:gosec
191191

192192
factory := dynamicinformer.NewFilteredDynamicSharedInformerFactory(inf.providerDynamicClient, time.Minute*30, sns.Status.Namespace, nil)
193193
gvrInf := factory.ForResource(inf.gvr)
194194
gvrInf.Lister() // to wire the GVR up in the informer factory
195-
inf.namespaceCancel[name] = func() { cancel(nil) }
195+
inf.namespaceCancel[name] = cancel
196196
inf.namespaceInformers[name] = gvrInf
197197

198198
for _, h := range inf.handlers {

pkg/konnector/controllers/cluster/serviceexport/serviceexport_reconcile.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func (r *reconciler) ensureControllerForSchema(ctx context.Context, export *kube
319319
}
320320

321321
// Create a new context for this controller
322-
ctxWithCancel, cancel := context.WithCancelCause(ctx)
322+
ctxWithCancel, cancel := context.WithCancel(ctx) //nolint:gosec
323323

324324
consumerInf.Start(ctxWithCancel.Done())
325325
providerInf.Start(ctxWithCancel)
@@ -338,7 +338,7 @@ func (r *reconciler) ensureControllerForSchema(ctx context.Context, export *kube
338338

339339
r.syncStore.Set(key, contextstore.SyncContext{
340340
Generation: export.Generation,
341-
Cancel: func() { cancel(nil) },
341+
Cancel: cancel,
342342
})
343343

344344
return nil
@@ -474,7 +474,7 @@ func (r *reconciler) ensureControllerForPermissionClaim(
474474

475475
logger.Info("creating claim reconciler", "gvr", claimGVR, "key", claimKey)
476476

477-
ctxWithCancel, cancel := context.WithCancelCause(ctx)
477+
ctxWithCancel, cancel := context.WithCancel(ctx) //nolint:gosec
478478
// Start the informers and controllers in a goroutine
479479
go func() {
480480
defer r.syncStore.Delete(claimKey)
@@ -502,7 +502,7 @@ func (r *reconciler) ensureControllerForPermissionClaim(
502502
// Store the controller context for tracking
503503
r.syncStore.Set(claimKey, contextstore.SyncContext{
504504
Generation: binding.Generation,
505-
Cancel: func() { cancel(nil) },
505+
Cancel: cancel,
506506
})
507507

508508
return nil

pkg/konnector/konnector_reconcile.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ func (r *reconciler) startClusterControllerForSecret(ctx context.Context, secret
127127
// will also handle real APIServiceBindings that use the same kubeconfig.
128128
syntheticKey := "__heartbeat__" + secret.Name
129129

130-
ctrlCtx, cancel := context.WithCancelCause(ctx)
130+
ctrlCtx, cancel := context.WithCancel(ctx)
131131
ctrlContext := &controllerContext{
132132
kubeconfig: kubeconfig,
133-
cancel: func() { cancel(nil) },
133+
cancel: cancel,
134134
serviceBindings: sets.New(syntheticKey),
135135
}
136136
r.controllers[syntheticKey] = ctrlContext
@@ -154,7 +154,7 @@ func (r *reconciler) startClusterControllerForSecret(ctx context.Context, secret
154154
)
155155
if err != nil {
156156
logger.Error(err, "failed to start cluster controller for heartbeat")
157-
cancel(nil)
157+
cancel()
158158
delete(r.controllers, syntheticKey)
159159
return err
160160
}
@@ -239,10 +239,10 @@ func (r *reconciler) reconcile(ctx context.Context, binding *kubebindv1alpha2.AP
239239
return nil // nothing we can do here. The APIServiceBinding Controller will set a condition
240240
}
241241

242-
ctrlCtx, cancel := context.WithCancelCause(ctx)
242+
ctrlCtx, cancel := context.WithCancel(ctx) //nolint:gosec
243243
r.controllers[binding.Name] = &controllerContext{
244244
kubeconfig: kubeconfig,
245-
cancel: func() { cancel(nil) },
245+
cancel: cancel,
246246
serviceBindings: sets.New(binding.Name),
247247
}
248248

0 commit comments

Comments
 (0)