Leader election lock name should include driver name

This commit is contained in:
zhucan
2019-06-19 15:00:07 +08:00
committed by zhuc
parent ac33959738
commit 94238a86d9

View File

@@ -73,8 +73,8 @@ var (
)
var (
version = "unknown"
leaderElectionLockName = "external-snapshotter-leader-election"
version = "unknown"
prefix = "external-snapshotter-leader"
)
func main() {
@@ -214,7 +214,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)
}