Documentation

Index

Constants

View Source
const (
	LocalLabelSelector     = "liqo.io/replication"
	RemoteLabelSelector    = "liqo.io/originID"
	DestinationLabel       = "liqo.io/remoteID"
	ReplicationStatuslabel = "liqo.io/replicated"
)

Variables

View Source
var (
	ResyncPeriod = 30 * time.Second
)

Functions

func SetLabelsForLocalResources

func SetLabelsForLocalResources(options *metav1.ListOptions)

Types

type Controller

type Controller struct {
	Scheme *runtime.Scheme
	client.Client
	ClientSet                      *kubernetes.Clientset
	ClusterID                      string
	RemoteDynClients               map[string]dynamic.Interface                            //for each remote cluster we save dynamic client connected to its API server
	RemoteDynSharedInformerFactory map[string]dynamicinformer.DynamicSharedInformerFactory //for each remote cluster we save the dynamic shared informer factory
	LocalDynClient                 dynamic.Interface                                       //dynamic client pointing to the local API server
	LocalDynSharedInformerFactory  dynamicinformer.DynamicSharedInformerFactory            //local dynamic shared informer factory
	RegisteredResources            []schema.GroupVersionResource                           //a list of GVRs of resources to be replicated
	UnregisteredResources          []string                                                //each time a resource is removed from the configuration it is saved in this list, it stays here until the associated watcher, if running, is stopped
	LocalWatchers                  map[string]chan struct{}                                //we save all the running watchers monitoring the local resources:(registeredResource, chan))
	RemoteWatchers                 map[string]map[string]chan struct{}                     //for each peering cluster we save all the running watchers monitoring the replicated resources:(clusterID, (registeredResource, chan))
}

func (*Controller) AddFunc

func (c *Controller) AddFunc(newObj interface{})

func (*Controller) AddedHandler

func (c *Controller) AddedHandler(obj *unstructured.Unstructured, gvr schema.GroupVersionResource)

func (*Controller) CreateResource

func (c *Controller) CreateResource(client dynamic.Interface, gvr schema.GroupVersionResource, obj *unstructured.Unstructured, clusterID string) error

func (*Controller) DeleteFunc

func (c *Controller) DeleteFunc(newObj interface{})

func (*Controller) DeleteResource

func (c *Controller) DeleteResource(client dynamic.Interface, gvr schema.GroupVersionResource, obj *unstructured.Unstructured, clusterID string) error

func (*Controller) DeletedHandler

func (c *Controller) DeletedHandler(obj *unstructured.Unstructured, gvr schema.GroupVersionResource)

func (*Controller) GetConfig

func (*Controller) GetRemovedResources

func (c *Controller) GetRemovedResources(resources []schema.GroupVersionResource) []string

func (*Controller) GetResource

func (c *Controller) GetResource(client dynamic.Interface, gvr schema.GroupVersionResource, name, namespace, clusterID string) (*unstructured.Unstructured, bool, error)

func (*Controller) ModifiedHandler

func (c *Controller) ModifiedHandler(obj *unstructured.Unstructured, gvr schema.GroupVersionResource)

func (*Controller) Reconcile

func (c *Controller) Reconcile(req ctrl.Request) (ctrl.Result, error)

func (*Controller) RemoteResourceModifiedHandler

func (c *Controller) RemoteResourceModifiedHandler(obj *unstructured.Unstructured, gvr schema.GroupVersionResource, remoteClusterId string)

func (*Controller) SetLabelsForRemoteResources

func (c *Controller) SetLabelsForRemoteResources(options *metav1.ListOptions)

func (*Controller) SetupWithManager

func (c *Controller) SetupWithManager(mgr ctrl.Manager) error

func (*Controller) StartWatchers

func (c *Controller) StartWatchers()

func (*Controller) StopWatchers

func (c *Controller) StopWatchers()

Stops all the watchers for the resources that have been unregistered

func (*Controller) UpdateConfig

func (c *Controller) UpdateConfig(cfg *configv1alpha1.ClusterConfig)

func (*Controller) UpdateFunc

func (c *Controller) UpdateFunc(oldObj, newObj interface{})

func (*Controller) UpdateLabels

func (c *Controller) UpdateLabels(labels map[string]string) map[string]string

func (*Controller) UpdateResource

func (c *Controller) UpdateResource(client dynamic.Interface, gvr schema.GroupVersionResource, obj *unstructured.Unstructured, clusterID string) error

func (*Controller) UpdateSpec

func (c *Controller) UpdateSpec(client dynamic.Interface, gvr schema.GroupVersionResource, obj *unstructured.Unstructured, clusterID string, spec map[string]interface{}) error

updates the spec field of a resource

func (*Controller) UpdateStatus

func (c *Controller) UpdateStatus(client dynamic.Interface, gvr schema.GroupVersionResource, obj *unstructured.Unstructured, clusterID string, status map[string]interface{}) error

updates the status field of a resource

func (*Controller) WatchConfiguration

func (c *Controller) WatchConfiguration(config *rest.Config, gv *schema.GroupVersion) error

func (*Controller) Watcher

func (c *Controller) Watcher(dynFac dynamicinformer.DynamicSharedInformerFactory, gvr schema.GroupVersionResource, handlerFuncs cache.ResourceEventHandlerFuncs, stopCh chan struct{})