diff --git a/cmd/csi-snapshotter/leader.go b/cmd/csi-snapshotter/leader.go index 10578dddb..c7c324465 100644 --- a/cmd/csi-snapshotter/leader.go +++ b/cmd/csi-snapshotter/leader.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "context" "fmt" "os" "time" @@ -70,7 +71,7 @@ func WaitForLeader(clientset *kubernetes.Clientset, namespace string, lockName s RenewDeadline: renewDeadline, RetryPeriod: retryPeriod, Callbacks: leaderelection.LeaderCallbacks{ - OnStartedLeading: func(stop <-chan struct{}) { + OnStartedLeading: func(ctx context.Context) { glog.V(2).Info("Became leader, starting") close(elected) }, @@ -84,7 +85,7 @@ func WaitForLeader(clientset *kubernetes.Clientset, namespace string, lockName s }, } - go leaderelection.RunOrDie(leaderConfig) + go leaderelection.RunOrDie(context.TODO(), leaderConfig) // wait for being elected <-elected