-
Notifications
You must be signed in to change notification settings - Fork 1.2k
✨ Take context when getting informer. #663
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
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 |
---|---|---|
|
@@ -57,7 +57,7 @@ func (ip *informerCache) Get(ctx context.Context, key client.ObjectKey, out runt | |
return err | ||
} | ||
|
||
started, cache, err := ip.InformersMap.Get(gvk, out) | ||
started, cache, err := ip.InformersMap.Get(ctx, gvk, out) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -76,7 +76,7 @@ func (ip *informerCache) List(ctx context.Context, out runtime.Object, opts ...c | |
return err | ||
} | ||
|
||
started, cache, err := ip.InformersMap.Get(*gvk, cacheTypeObj) | ||
started, cache, err := ip.InformersMap.Get(ctx, *gvk, cacheTypeObj) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -128,7 +128,6 @@ func (ip *informerCache) objectTypeForListObject(list runtime.Object) (*schema.G | |
} | ||
|
||
return &gvk, cacheTypeObj, nil | ||
|
||
} | ||
|
||
// GetInformerForKind returns the informer for the GroupVersionKind | ||
|
@@ -138,7 +137,10 @@ func (ip *informerCache) GetInformerForKind(gvk schema.GroupVersionKind) (Inform | |
if err != nil { | ||
return nil, err | ||
} | ||
_, i, err := ip.InformersMap.Get(gvk, obj) | ||
|
||
// TODO(djzager): before a context can be passed down, the Informers interface | ||
// must be updated to accept a context when getting an informer | ||
_, i, err := ip.InformersMap.Get(context.TODO(), gvk, obj) | ||
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. can you add a TODO here explaining what we'd need to do to plumb this through? 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. My best attempt at an explanation. WDYT? 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. sure, looks good. Do you mind putting together a follow-up to do that? |
||
if err != nil { | ||
return nil, err | ||
} | ||
|
@@ -151,7 +153,10 @@ func (ip *informerCache) GetInformer(obj runtime.Object) (Informer, error) { | |
if err != nil { | ||
return nil, err | ||
} | ||
_, i, err := ip.InformersMap.Get(gvk, obj) | ||
|
||
// TODO(djzager): before a context can be passed down, the Informers interface | ||
// must be updated to accept a context when getting an informer | ||
_, i, err := ip.InformersMap.Get(context.TODO(), gvk, obj) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.