mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Add dynamic client resource watch function
This commit is contained in:
parent
a3248a7ba8
commit
82d76e2d6d
@ -1286,6 +1286,14 @@ func taintExists(taints []v1.Taint, taintToFind *v1.Taint) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func getDynamicResourceWatch(testContext context.Context, dc dynamic.Interface, resourceType schema.GroupVersionResource, namespace string, resourceName string, listOptions metav1.ListOptions) func() (watch.Interface, error) {
|
||||
return func() (watch.Interface, error) {
|
||||
res, err := dc.Resource(resourceType).Namespace(namespace).Watch(context.TODO(), listOptions)
|
||||
ExpectNoError(err, "Failed to create a watch for %v", resourceType.Resource)
|
||||
return res, err
|
||||
}
|
||||
}
|
||||
|
||||
// WatchEventEnsurerAndManager
|
||||
// manages a watch for a given resource, ensures that events take place in a given order, retries the test on failure
|
||||
// testContext cancelation signal across API boundries, e.g: context.TODO()
|
||||
|
Loading…
Reference in New Issue
Block a user