cluster

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeTenantCluster

func NewFakeTenantCluster(vc *v1alpha1.Virtualcluster, fakeClientSet clientset.Interface, fakeClient client.Client) (*fakeCluster, error)

Types

type CacheOptions

type CacheOptions struct {
	// Resync is the period between cache resyncs.
	// A cache resync triggers event handlers for each object watched by the cache.
	// It can be useful if your level-based logic isn't perfect.
	Resync *time.Duration
	// Namespace can be used to watch only a single namespace.
	// If unset (Namespace == ""), all namespaces are watched.
	Namespace string
}

CacheOptions is embedded in Options to configure the new Cluster's cache.

type Cluster

type Cluster struct {

	// Config is the rest.config used to talk to the apiserver.  Required.
	RestConfig *rest.Config

	Options
	// contains filtered or unexported fields
}

Each Cluster object represents a tenant master in Virtual Cluster architecture.

Cluster implements the ClusterInterface used by MultiClusterController in github.com/kubernetes-sigs/multi-tenancy/incubator/virtualcluster/pkg/syncer/mccontroller/mccontroller.go.

It stores a Kubernetes client, cache, and other cluster-scoped dependencies. The dependencies are lazily created in getters and cached for reuse. It is not thread safe.

func NewTenantCluster

func NewTenantCluster(key, namespace, name, uid string, vclister vclisters.VirtualclusterLister, configBytes []byte, o Options) (*Cluster, error)

New creates a new Cluster.

func (*Cluster) AddEventHandler

func (c *Cluster) AddEventHandler(objectType runtime.Object, handler clientgocache.ResourceEventHandler) error

AddEventHandler instructs the Cluster's cache to watch objectType's resource, if it doesn't already, and to add handler as an event handler.

func (*Cluster) GetClientSet

func (c *Cluster) GetClientSet() (clientset.Interface, error)

GetClientSet returns a clientset client without any informer caches. All client requests go to apiserver directly.

func (*Cluster) GetClusterName

func (c *Cluster) GetClusterName() string

GetClusterName returns the unique cluster name, aka, the root namespace name.

func (*Cluster) GetDelegatingClient

func (c *Cluster) GetDelegatingClient() (client.Client, error)

GetDelegatingClient returns a lazily created controller-runtime DelegatingClient. It is used by other Cluster getters, and by reconcilers. TODO: consider implementing Reader, Writer and StatusClient in Cluster and forwarding to actual delegating client.

func (*Cluster) GetOwnerInfo

func (c *Cluster) GetOwnerInfo() (string, string, string)

func (*Cluster) GetSpec

func (c *Cluster) GetSpec() (*v1alpha1.VirtualclusterSpec, error)

GetSpec returns the virtual cluster spec.

func (*Cluster) SetSynced

func (c *Cluster) SetSynced()

func (*Cluster) Start

func (c *Cluster) Start() error

Start starts the Cluster's cache and blocks, until an empty struct is sent to the stop channel.

func (*Cluster) Stop

func (c *Cluster) Stop()

Stop send a msg to stopCh, stop the cache.

func (*Cluster) WaitForCacheSync

func (c *Cluster) WaitForCacheSync() bool

WaitForCacheSync waits for the Cluster's cache to sync, OR until an empty struct is sent to the stop channel.

type Options

type Options struct {
	CacheOptions
}

Options are the arguments for creating a new Cluster.

Jump to

Keyboard shortcuts

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