controllermanager

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerNamePrefix = "syncer-controller-manager-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerManager

type ControllerManager struct {
	// contains filtered or unexported fields
}

ControllerManager is a component that manages (create/start/stop) GVR-specific controllers according to available GVRs. It reacts to the changes of supported GVRs in a DiscoveringDynamicSharedInformerFactory (the GVRs for which an informer has been automatically created, started and synced), and starts / stops registered GVRs-specific controllers according to the GVRs they depend on.

For example this allows starting PVC / PV controllers only when PVC / PV resources are exposed by the Syncer and UpSyncer virtual workspaces, and Informers for them have been started and synced by the corresponding ddsif.

func NewControllerManager

func NewControllerManager(ctx context.Context, suffix string, informerSource InformerSource, controllers map[string]ManagedController) *ControllerManager

NewControllerManager creates a new ControllerManager which will manage (create/start/stop) GVR-specific controllers according to informers available in the provided InformerSource.

func (*ControllerManager) Start

func (c *ControllerManager) Start(ctx context.Context)

Start starts the controller, which stops when ctx.Done() is closed.

type CreateControllerFunc

type CreateControllerFunc func(ctx context.Context) (StartControllerFunc, error)

type InformerSource

type InformerSource struct {
	// Subscribe registers for informer change notifications, returning a channel to which change notifications are sent.
	// The id argument is the identifier of the subscriber, since there might be several subscribers subscribing
	// to receive events from this InformerSource.
	Subscribe func(id string) <-chan struct{}

	// Informers returns a map of per-resource-type SharedIndexInformers for all types that are
	// known by this informer source, and that are synced.
	//
	// It also returns the list of informers that are known by this informer source, but sill not synced.
	Informers func() (informers map[schema.GroupVersionResource]cache.SharedIndexInformer, notSynced []schema.GroupVersionResource)
}

InformerSource is a dynamic source of informers per GVR, which notifies when informers are added or removed for some GVR. It is implemented by the DynamicSharedInformerFactory (in fact by both the scoped or cluster-aware variants).

type ManagedController

type ManagedController struct {
	RequiredGVRs []schema.GroupVersionResource
	Create       CreateControllerFunc
}

ManagedController defines a controller that should be managed by a ControllerManager, to be started when the required GVRs are supported, and stopped when the required GVRs are not supported anymore.

type StartControllerFunc

type StartControllerFunc func(ctx context.Context)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL