Skip to content

Commit

Permalink
update election
Browse files Browse the repository at this point in the history
  • Loading branch information
wackxu committed Oct 15, 2018
1 parent b16bad3 commit 64753f4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/csi-snapshotter/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
"context"
"fmt"
"os"
"time"
Expand Down Expand Up @@ -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)
},
Expand All @@ -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
Expand Down

0 comments on commit 64753f4

Please sign in to comment.