-
Notifications
You must be signed in to change notification settings - Fork 1.2k
⚠ update Informers interface to accept context #830
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
Conversation
Hi @djzager. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@DirectXMan12 follow-up to #663 |
Made this |
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.
/ok-to-test
@@ -51,11 +52,11 @@ type Cache interface { | |||
type Informers interface { | |||
// GetInformer fetches or constructs an informer for the given object that corresponds to a single | |||
// API kind and resource. | |||
GetInformer(obj runtime.Object) (Informer, error) | |||
GetInformer(ctx context.Context, obj runtime.Object) (Informer, error) |
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.
@DirectXMan12 what is our policy for breaking changes? IMHO this change would be extremely great, if we want to give a longer deprecation period we could probably add a new InformersV2
interface and start using that internally?
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.
We'll probably need to add this to v0.6 if it's a breaking change
@alvaroaleman I made it |
A testcase that tries to get an informer from an envtest cluster with a context with super low timeout (1 ms or sth), then verifying the error is |
Update all functions on the Informers interface (and IndexField on FieldIndexer interface) to accept a context.
c18717b
to
b6d18c7
Compare
@@ -98,7 +99,7 @@ func (ks *Kind) Start(handler handler.EventHandler, queue workqueue.RateLimiting | |||
} | |||
|
|||
// Lookup the Informer from the Cache and add an EventHandler which populates the Queue | |||
i, err := ks.cache.GetInformer(ks.Type) | |||
i, err := ks.cache.GetInformer(context.TODO(), ks.Type) |
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.
Do we need to add context.Context
to the Source
interface's Start
method to make this cancellable?
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 guess, but maybe we can do that in a follow-up?
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.
/approve
/assign @alvaroaleman @DirectXMan12
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: djzager, vincepri 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 |
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
/hold
@vincepri are we good with merging breaking changes?
@@ -98,7 +99,7 @@ func (ks *Kind) Start(handler handler.EventHandler, queue workqueue.RateLimiting | |||
} | |||
|
|||
// Lookup the Informer from the Cache and add an EventHandler which populates the Queue | |||
i, err := ks.cache.GetInformer(ks.Type) | |||
i, err := ks.cache.GetInformer(context.TODO(), ks.Type) |
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 guess, but maybe we can do that in a follow-up?
yep, we discussed at yesterday's meeting and we opened master to v0.6 |
/hold cancel |
Update all functions on the Informers interface (and IndexField on
FieldIndexer interface) to accept a context.
Fixes #828