fix: apply patch

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
Signed-off-by: Ron Green <11993626+georgettica@users.noreply.github.com>
This commit is contained in:
Ron Green
2021-01-26 11:55:03 +02:00
parent 8bb3615339
commit ef07b72dbc
2 changed files with 3 additions and 20 deletions

View File

@@ -29,25 +29,8 @@ import (
// Runnable will turn a "regular" runnable component (such as a controller)
// into a controller-runtime Runnable
func Runnable(p controller.Interface, numWorkers int) manager.Runnable {
f := func(stop <-chan struct{}) error {
// Create a cancel context for handling the stop signal.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// If a signal is received on the stop channel, cancel the
// context. This will propagate the cancel into the p.Run
// function below.
go func() {
select {
case <-stop:
cancel()
case <-ctx.Done():
}
}()
// This is a blocking call that either completes
// or is cancellable on receiving a stop signal.
// Pass the provided Context down to the run function.
f := func(ctx context.Context) error {
return p.Run(ctx, numWorkers)
}
return manager.RunnableFunc(f)

View File

@@ -859,7 +859,7 @@ func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]string
s.logger.Info("Server starting...")
if err := s.mgr.Start(s.ctx.Done()); err != nil {
if err := s.mgr.Start(s.ctx); err != nil {
s.logger.Fatal("Problem starting manager", err)
}