cluster

package
v0.0.0-...-44dad58 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 18 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
	// WatchNamespace can be used to watch only a single namespace.
	// If unset (Namespace == ""), all namespaces are watched.
	WatchNamespace 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
	// contains filtered or unexported fields
}

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

Cluster implements the ClusterInterface used by MultiClusterController in sigs.k8s.io/multi-tenancy/incubator/virtualcluster/pkg/util/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 NewCluster

func NewCluster(key, namespace, name, uid string, getter mccontroller.Getter, configBytes []byte, o Options) (*Cluster, error)

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) GetInformer

func (c *Cluster) GetInformer(objectType runtime.Object) (cache.Informer, error)

GetInformer fetches or constructs an informer for the given object that corresponds to a single API kind and resource.

func (*Cluster) GetObject

func (c *Cluster) GetObject() (runtime.Object, error)

GetObject returns the cluster object.

func (*Cluster) GetOwnerInfo

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

func (*Cluster) GetRestConfig

func (c *Cluster) GetRestConfig() *rest.Config

GetRestConfig returns restful configuration of virtual cluster client

func (*Cluster) SetKey

func (c *Cluster) SetKey(k string)

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
	// RequestTimeout is the rest client request timeout.
	// Set this to something reasonable so request to apiserver don't hang forever.
	RequestTimeout time.Duration
}

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