var ( ErrAlreadyExist = errors.New("controllers of cluster has already been started") ErrNotExist = errors.New("controllers of cluster doesn't exist") )
RemoteClusterRegistry will manage all controllers running on a remote cluster. The construction of these controllers (managers) will be managed by `fx`. The main process of constructing a controller manage is nearly the same with the main one. The only difference is that we'll need to provide a new `RestConfig`, and `Populate` the client to allow others to use its client.
type RemoteClusterRegistry struct {
// contains filtered or unexported fields
}
func New(logger logr.Logger, client client.Client) *RemoteClusterRegistry
func (r *RemoteClusterRegistry) Spawn(name string, config *rest.Config) error
Spawn starts the controller-manager and watches the remote cluster
func (r *RemoteClusterRegistry) Stop(ctx context.Context, name string) error
Stop stops the running controller-manager which watches the remote cluster.
func (r *RemoteClusterRegistry) WithClient(name string, f func(c client.Client) error) error
WithClient enables developer getting a client of remote cluster to operate inside the remote cluster.
TODO: add more kinds of client, like `no-cache` into this registry, if they are needed