cluster

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: Apache-2.0 Imports: 9 Imported by: 12

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 {
	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

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

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

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 added in v0.1.0

func (c *Cluster) GetClusterName() string

GetClusterName returns the context given when Cluster c was created.

func (*Cluster) GetDelegatingClient

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

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

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

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

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

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.

Jump to

Keyboard shortcuts

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