-
Notifications
You must be signed in to change notification settings - Fork 143
Use leader election library in csi-lib-utils #31
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
Use leader election library in csi-lib-utils #31
Conversation
cmd/csi-resizer/main.go
Outdated
if !*enableLeaderElection { | ||
run(context.TODO()) | ||
} else { | ||
if *leaderElectionIdentity == "" { |
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.
I would like to deprecate this flag since csi-lib-utils will check the pod hostname if the identity is not explicitly set.
cmd/csi-resizer/main.go
Outdated
@@ -42,6 +44,7 @@ var ( | |||
showVersion = flag.Bool("version", false, "Show version") | |||
|
|||
enableLeaderElection = flag.Bool("leader-election", false, "Enable leader election.") | |||
leaderElectionType = flag.String("leader-election-type", "endpoints", "the type of leader election, options are 'endpoints' (default) or 'lease' (strongly recommended)") |
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.
resizer is still alpha (and not officially released yet). Let's just start from lease :-)
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.
gladly :)
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.
Going to also remove identity, retry, lease duration & renew flags. Easier to add later than to remove
/assign @gnufied |
cmd/csi-resizer/main.go
Outdated
"before it is replaced by another candidate. This is only applicable if leader "+ | ||
"election is enabled.") | ||
enableLeaderElection = flag.Bool("leader-election", false, "Enable leader election.") | ||
leaderElectionNamespace = flag.String("leader-election-namespace", "Namespace where this resizer runs.") |
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.
Did you test this code? The flag.String
method needs three arguments but you only provides two, this will make the CI test failed.
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.
good catch, thanks
866a15a
to
f2f6d43
Compare
/lgtm |
/hold Waiting for kubernetes-csi/csi-lib-utils#24 |
f2f6d43
to
e6000bc
Compare
Update commit msg and RBAC |
…se based leader election Signed-off-by: Andrew Sy Kim <[email protected]>
e6000bc
to
9613183
Compare
/hold cancel |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewsykim, msau42 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -71,6 +71,9 @@ rules: | |||
- apiGroups: [""] |
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.
Oops can we remove the endpoints rule?
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.
yes, I'll follow-up
Also updates kubernetes client to v1.14.0 and adds an option to use lease based leader election (highly recommended) over Endpoints.
/assign @msau42 @xing-yang @jsafrane