mccontroller

package
v0.0.0-...-ff2d8de Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Start() error
	WaitForCacheSync() bool
	Stop()
}

Cache is the interface used by Controller to start and wait for caches to sync.

type ClusterInterface

type ClusterInterface interface {
	GetClusterName() string
	GetOwnerInfo() (string, string, string)
	GetSpec() (*v1alpha1.VirtualclusterSpec, error)
	AddEventHandler(runtime.Object, clientgocache.ResourceEventHandler) error
	GetClientSet() (clientset.Interface, error)
	GetDelegatingClient() (client.Client, error)
	Cache
}

ClusterInterface decouples the controller package from the cluster package.

type MultiClusterController

type MultiClusterController struct {
	sync.Mutex

	Options
	// contains filtered or unexported fields
}

MultiClusterController implements the multicluster controller pattern. A MultiClusterController owns a client-go workqueue. The WatchClusterResource methods set up the queue to receive reconcile requests, e.g., CRUD events from a tenant cluster. The Requests are processed by the user-provided Reconciler. MultiClusterController saves all watched tenant clusters in a set.

func NewMCController

func NewMCController(name string, objectType runtime.Object, options Options) (*MultiClusterController, error)

NewMCController creates a new MultiClusterController.

func (*MultiClusterController) Get

func (c *MultiClusterController) Get(clusterName, namespace, name string) (interface{}, error)

Get returns object with specific cluster, namespace and name.

func (*MultiClusterController) GetByObjectType

func (c *MultiClusterController) GetByObjectType(clusterName, namespace, name string, objectType runtime.Object) (interface{}, error)

GetByObjectType returns object with specific cluster, namespace and name and object type

func (*MultiClusterController) GetClusterClient

func (c *MultiClusterController) GetClusterClient(clusterName string) (clientset.Interface, error)

GetClusterClient returns the cluster's clientset client for direct access to tenant apiserver

func (*MultiClusterController) GetClusterDomain

func (c *MultiClusterController) GetClusterDomain(clusterName string) (string, error)

GetClusterDomain returns the cluster's domain name specified in VirtualclusterSpec

func (*MultiClusterController) GetClusterNames

func (c *MultiClusterController) GetClusterNames() []string

GetClusterNames returns the name list of all managed tenant clusters

func (*MultiClusterController) GetOwnerInfo

func (c *MultiClusterController) GetOwnerInfo(clusterName string) (string, string, string, error)

func (*MultiClusterController) GetSpec

func (c *MultiClusterController) GetSpec(clusterName string) (*v1alpha1.VirtualclusterSpec, error)

func (*MultiClusterController) List

func (c *MultiClusterController) List(clusterName string) (interface{}, error)

List returns a list of objects with specific cluster.

func (*MultiClusterController) ListByObjectType

func (c *MultiClusterController) ListByObjectType(clusterName string, objectType runtime.Object) (interface{}, error)

ListByObjectType returns a list of objects with specific cluster and object type.

func (*MultiClusterController) RequeueObject

func (c *MultiClusterController) RequeueObject(clusterName string, obj interface{}) error

RequeueObject requeues the cluster object, thus reconcileHandler can reconcile it again.

func (*MultiClusterController) Start

func (c *MultiClusterController) Start(stop <-chan struct{}) error

Start starts the ClustersController's control loops (as many as MaxConcurrentReconciles) in separate channels and blocks until an empty struct is sent to the stop channel.

func (*MultiClusterController) TeardownClusterResource

func (c *MultiClusterController) TeardownClusterResource(cluster ClusterInterface)

TeardownClusterResource forget the cluster it watches. The cluster informer should stop together.

func (*MultiClusterController) WatchClusterResource

func (c *MultiClusterController) WatchClusterResource(cluster ClusterInterface, o WatchOptions) error

WatchClusterResource configures the Controller to watch resources of the same Kind as objectType, in the specified cluster, generating reconcile Requests from the ClusterInterface's context and the watched objects' namespaces and names.

type Options

type Options struct {
	// JitterPeriod is the time to wait after an error to start working again.
	JitterPeriod time.Duration

	// MaxConcurrentReconciles is the number of concurrent control loops.
	MaxConcurrentReconciles int

	Reconciler reconciler.DWReconciler

	// Queue can be used to override the default queue.
	Queue workqueue.RateLimitingInterface
}

Options are the arguments for creating a new Controller.

type WatchOptions

type WatchOptions struct {
}

WatchOptions is used as an argument of WatchResource methods (just a placeholder for now). TODO: consider implementing predicates.

Jump to

Keyboard shortcuts

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