diff --git a/pkg/internal/controller/controller_test.go b/pkg/internal/controller/controller_test.go index 9bb24c5f3b..7f62e5d17d 100644 --- a/pkg/internal/controller/controller_test.go +++ b/pkg/internal/controller/controller_test.go @@ -346,9 +346,9 @@ var _ = Describe("controller", func() { Expect(err.Error()).To(Equal("can not restart a stopped controller, you should create a new one")) }) - It("should be possible to cancel the controller using NewCancelRunnable", func() { + It("should be possible to cancel the controller using RunnableWithCancel", func() { stoppedChan := make(chan struct{}) - cancellableController, cancel := manager.NewCancelRunnable(ctrl) + cancellableController, cancel := manager.RunnableWithCancel(ctrl) go func() { defer close(stoppedChan) diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 0186010001..a5cf418aa6 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -342,8 +342,8 @@ type LeaderElectionRunnable interface { NeedLeaderElection() bool } -// NewCancelRunnable returns a new Runnable and a function to cancel that runnable. -func NewCancelRunnable(r Runnable) (Runnable, context.CancelFunc) { +// RunnableWithCancel returns a new Runnable and a function to cancel that runnable. +func RunnableWithCancel(r Runnable) (Runnable, context.CancelFunc) { mu := sync.Mutex{} var cancels []func() canceled := false