-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leader election lock name should include driver name #129
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import ( | |
"fmt" | ||
"os" | ||
"os/signal" | ||
"strings" | ||
"time" | ||
|
||
"google.golang.org/grpc" | ||
|
@@ -73,8 +74,8 @@ var ( | |
) | ||
|
||
var ( | ||
version = "unknown" | ||
leaderElectionLockName = "external-snapshotter-leader-election" | ||
version = "unknown" | ||
prefix = "external-snapshotter-leader" | ||
) | ||
|
||
func main() { | ||
|
@@ -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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need this prefix at all. The lockName used in the provisioner does not have a prefix: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do need the prefix otherwise the name will conflict with other sidecar's locks. provisioner unfortunately has more backwards compatibility concerns so it's not so easy to fix: kubernetes-csi/external-provisioner#295 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sound good. |
||
le := leaderelection.NewLeaderElection(kubeClient, lockName, run) | ||
if *leaderElectionNamespace != "" { | ||
le.WithNamespace(*leaderElectionNamespace) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msau42 Is there any limitation on the length of the lockName? This prefix is a little longer. Other than that, I'm fine with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhucan Can you shorten this prefix to just "snapshotter"?
@msau42 Are there any naming convention? If not, I'll just go with "snapshotter". Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attacher and resizer all use "external-" prefix. Probably we should just be the same to be consistent.
In terms of length, the name is used as the ObjectMeta.Name, which is 253 characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.