-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
🐛 InformerCache: Do not require leader lease #678
🐛 InformerCache: Do not require leader lease #678
Conversation
@@ -140,6 +140,12 @@ func (ip *informerCache) GetInformer(obj runtime.Object) (Informer, error) { | |||
return i.Informer, err | |||
} | |||
|
|||
// NeedLeaderElection implements the LeaderElectionRunnable interface |
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.
Unfortunately we can not verify the interface implementation via a var _ manager.LeaderElectionRunnable = &informerCache{}
as that would result in an import cycle
Expect(err).ToNot(HaveOccurred()) | ||
|
||
c, err := cache.New(cfg, cache.Options{Mapper: mapper}) | ||
Expect(err).ToNot(HaveOccurred()) |
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 couldn't find a matcher for "type X implements interface Y", the closed to that I found is BeAssignableToTypeOf
but that errors out if one of the two is nil.
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.
this is clear enough. If you're really worried, you can always add an explanation after the "be true" part as a format string, but I think this is readable enough for now.
/assign @DirectXMan12 |
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.
/lgtm
/approve
Expect(err).ToNot(HaveOccurred()) | ||
|
||
c, err := cache.New(cfg, cache.Options{Mapper: mapper}) | ||
Expect(err).ToNot(HaveOccurred()) |
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.
this is clear enough. If you're really worried, you can always add an explanation after the "be true" part as a format string, but I think this is readable enough for now.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, DirectXMan12 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 |
This PR makes the
informerCache
implement theLeaderElectionRunnable
interface to signal that it doesn't need leader election. This is done so otherrunnables
that also do not need leader election can use the cache-backed reader.Fixes #677