mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-03-26 08:41:14 +08:00
client-go informers: provide ListWatch *WithContext variants
For compatibility reasons, the old functions without the ctx parameter still get generated, now with context.Background instead of context.TODO. In practice that code won't be used by the client-go reflector code because it prefers the *WithContext functions, but it cannot be ruled out that some other code only supports the old fields. Kubernetes-commit: 8cc74e8a266e1042be1c60adfa3091852036f48a
This commit is contained in:
parent
f94f578f4c
commit
144c6b454a
@ -62,13 +62,25 @@ func NewFilteredFooInformer(client versioned.Interface, namespace string, resync
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SamplecontrollerV1alpha1().Foos(namespace).List(context.TODO(), options)
|
||||
return client.SamplecontrollerV1alpha1().Foos(namespace).List(context.Background(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SamplecontrollerV1alpha1().Foos(namespace).Watch(context.TODO(), options)
|
||||
return client.SamplecontrollerV1alpha1().Foos(namespace).Watch(context.Background(), options)
|
||||
},
|
||||
ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SamplecontrollerV1alpha1().Foos(namespace).List(ctx, options)
|
||||
},
|
||||
WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.SamplecontrollerV1alpha1().Foos(namespace).Watch(ctx, options)
|
||||
},
|
||||
},
|
||||
&apissamplecontrollerv1alpha1.Foo{},
|
||||
|
Loading…
x
Reference in New Issue
Block a user