Skip to content
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

Extend ResourceLock interface to include leader election config #77204

Closed

Conversation

vikaschoudhary16
Copy link
Contributor

@vikaschoudhary16 vikaschoudhary16 commented Apr 29, 2019

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
This PR is required for making leader election configuration for Lease duration, renew duration and retry duration to be configurable options. Currently these are hard-coded.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
Related PR# kubernetes-sigs/controller-runtime#412

Does this PR introduce a user-facing change?:

None

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 29, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vikaschoudhary16
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: mikedanese

If they are not already assigned, you can assign the PR to them by writing /assign @mikedanese in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 29, 2019
@fedebongio
Copy link
Contributor

/cc @cheftako

@@ -85,6 +95,9 @@ type Interface interface {
// Identity will return the locks Identity
Identity() string

// LeaderElectionConfig will return leader election's lease duration, lease renew and retry configurations
LeaderElectionConfig() (*int, *int, *int)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

odd to hide implementation behind an interface and then intentionally leaking this information. Who is a consumer of this? Isn't the consumer also the same who creates the object?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can those values be nil?

@@ -89,6 +89,11 @@ func (ll *LeaseLock) Identity() string {
return ll.LockConfig.Identity
}

// returns the leader election config of the lock
func (ll *LeaseLock) LeaderElectionConfig() (*int, *int, *int) {
return &ll.LockConfig.LeaseDurationSeconds, &ll.LockConfig.RenewDeadlineSeconds, &ll.LockConfig.RetryPeriodSeconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, now I get this. I don't like it at all to open up internals like that. Who locks those values?

If we want a way to change those values, add a setter method.

@sttts
Copy link
Contributor

sttts commented Apr 30, 2019

/hold

The approach does not look right. Leaking pointers to unprotected internal state is dangerous.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 30, 2019
@vikaschoudhary16
Copy link
Contributor Author

@sttts Thanks for the comments.

Who is a consumer of this? Isn't the consumer also the same who creates the object?

Yeah, looks like it can handle entirely in consumer (i.e controller-runtime), without requiring changes in this part, so closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/bug Categorizes issue or PR as related to a bug. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants