mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #12795 from soltysh/list_watch_client
Allow using NewListWatchFromClient from other client implementation
This commit is contained in:
commit
45007431bc
7
pkg/client/cache/listwatch.go
vendored
7
pkg/client/cache/listwatch.go
vendored
@ -37,8 +37,13 @@ type ListWatch struct {
|
||||
WatchFunc WatchFunc
|
||||
}
|
||||
|
||||
// Getter interface knows how to access Get method from RESTClient.
|
||||
type Getter interface {
|
||||
Get() *client.Request
|
||||
}
|
||||
|
||||
// NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and field selector.
|
||||
func NewListWatchFromClient(c *client.Client, resource string, namespace string, fieldSelector fields.Selector) *ListWatch {
|
||||
func NewListWatchFromClient(c Getter, resource string, namespace string, fieldSelector fields.Selector) *ListWatch {
|
||||
listFunc := func() (runtime.Object, error) {
|
||||
return c.Get().
|
||||
Namespace(namespace).
|
||||
|
Loading…
Reference in New Issue
Block a user