multicluster-controller: admiralty.io/multicluster-controller/pkg/cluster Index | Files

package cluster

import "admiralty.io/multicluster-controller/pkg/cluster"

Package cluster handles Kubernetes dependencies. They are grouped by cluster under Cluster structs.

Index

Package Files

cluster.go

type CacheOptions Uses

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 Uses

type Cluster struct {
    Name   string
    Config *rest.Config

    Options
    // contains filtered or unexported fields
}

Cluster stores a Kubernetes client, cache, and other cluster-scoped dependencies. The dependencies are lazily created in getters and cached for reuse.

func New Uses

func New(name string, config *rest.Config, o Options) *Cluster

New creates a new Cluster.

func (*Cluster) AddEventHandler Uses

func (c *Cluster) AddEventHandler(ctx context.Context, 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) CloneWithName Uses

func (c *Cluster) CloneWithName(name string) *Cluster

CloneWithName creates a new Cluster with the same Kubernetes client, cache, and other cluster-scoped dependencies, but with a different name. This is useful in situations where one cluster is known to other clusters by different names. In particular, this avoids duplicating caches and reduces the load on the Kubernetes API server.

func (*Cluster) GetCache Uses

func (c *Cluster) GetCache() (cache.Cache, error)

GetCache returns a lazily created controller-runtime Cache. It is used by other Cluster getters. TODO: consider not exporting.

func (*Cluster) GetClusterName Uses

func (c *Cluster) GetClusterName() string

GetClusterName returns the context given when Cluster c was created.

func (*Cluster) GetDelegatingClient Uses

func (c *Cluster) GetDelegatingClient() (*client.DelegatingClient, 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) GetMapper Uses

func (c *Cluster) GetMapper() (meta.RESTMapper, error)

GetMapper returns a lazily created apimachinery RESTMapper. It is used by other Cluster getters. TODO: consider not exporting.

func (*Cluster) GetScheme Uses

func (c *Cluster) GetScheme() *runtime.Scheme

GetScheme returns the default client-go scheme. It is used by other Cluster getters, and to add custom resources to the scheme.

func (*Cluster) Start Uses

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

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

func (*Cluster) WaitForCacheSync Uses

func (c *Cluster) WaitForCacheSync(stop <-chan struct{}) bool

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

type Options Uses

type Options struct {
    CacheOptions
}

Options is used as an argument of New. For now it only embeds CacheOptions but we could add non-cache options in the future.

Package cluster imports 10 packages (graph) and is imported by 6 packages. Updated 2020-06-07. Refresh now. Tools for package owners.