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:
Patrick Ohly
2024-12-09 16:04:52 +01:00
committed by Kubernetes Publisher
parent bad1caabde
commit e8a7cb0e18
128 changed files with 1792 additions and 256 deletions

View File

@@ -61,13 +61,25 @@ func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod t
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NodeV1alpha1().RuntimeClasses().List(context.TODO(), options)
return client.NodeV1alpha1().RuntimeClasses().List(context.Background(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NodeV1alpha1().RuntimeClasses().Watch(context.TODO(), options)
return client.NodeV1alpha1().RuntimeClasses().Watch(context.Background(), options)
},
ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NodeV1alpha1().RuntimeClasses().List(ctx, options)
},
WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NodeV1alpha1().RuntimeClasses().Watch(ctx, options)
},
},
&apinodev1alpha1.RuntimeClass{},