Merge pull request #129 from zhucan/bugfix-128

Leader election lock name should include driver name
This commit is contained in:
Kubernetes Prow Robot
2019-07-11 17:15:05 -07:00
committed by GitHub

View File

@@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"os" "os"
"os/signal" "os/signal"
"strings"
"time" "time"
"google.golang.org/grpc" "google.golang.org/grpc"
@@ -73,8 +74,8 @@ var (
) )
var ( var (
version = "unknown" version = "unknown"
leaderElectionLockName = "external-snapshotter-leader-election" prefix = "external-snapshotter-leader"
) )
func main() { func main() {
@@ -214,7 +215,8 @@ func main() {
if !*leaderElection { if !*leaderElection {
run(context.TODO()) run(context.TODO())
} else { } else {
le := leaderelection.NewLeaderElection(kubeClient, leaderElectionLockName, run) lockName := fmt.Sprintf("%s-%s", prefix, strings.Replace(*snapshotterName, "/", "-", -1))
le := leaderelection.NewLeaderElection(kubeClient, lockName, run)
if *leaderElectionNamespace != "" { if *leaderElectionNamespace != "" {
le.WithNamespace(*leaderElectionNamespace) le.WithNamespace(*leaderElectionNamespace)
} }