Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/client/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package client

import (
"context"
"errors"
"strings"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -35,6 +36,15 @@ func NewWithWatch(config *rest.Config, options Options) (WithWatch, error) {
return &watchingClient{client: client}, nil
}

// AsWithWatch wraps an existing client in a WithWatch
func AsWithWatch(c Client) (WithWatch, error) {
cl, ok := c.(*client)
if !ok {
return nil, errors.New("incompatible client type")
}
return &watchingClient{client: cl}, nil
}

type watchingClient struct {
*client
}
Expand Down