Skip to content

Commit

Permalink
Merge pull request #129 from zhucan/bugfix-128
Browse files Browse the repository at this point in the history
Leader election lock name should include driver name
  • Loading branch information
k8s-ci-robot authored Jul 12, 2019
2 parents c0658cb + e250652 commit d69cf48
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/csi-snapshotter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"os"
"os/signal"
"strings"
"time"

"google.golang.org/grpc"
Expand Down Expand Up @@ -73,8 +74,8 @@ var (
)

var (
version = "unknown"
leaderElectionLockName = "external-snapshotter-leader-election"
version = "unknown"
prefix = "external-snapshotter-leader"
)

func main() {
Expand Down Expand Up @@ -214,7 +215,8 @@ func main() {
if !*leaderElection {
run(context.TODO())
} 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 != "" {
le.WithNamespace(*leaderElectionNamespace)
}
Expand Down

0 comments on commit d69cf48

Please sign in to comment.