Documentation ¶
Overview ¶
Package cluster handles Kubernetes dependencies. They are grouped by cluster under Cluster structs.
Index ¶
- type CacheOptions
- type Cluster
- func (c *Cluster) AddEventHandler(ctx context.Context, objectType runtime.Object, ...) error
- func (c *Cluster) CloneWithName(name string) *Cluster
- func (c *Cluster) GetCache() (cache.Cache, error)
- func (c *Cluster) GetClusterName() string
- func (c *Cluster) GetDelegatingClient() (*client.DelegatingClient, error)
- func (c *Cluster) GetMapper() (meta.RESTMapper, error)
- func (c *Cluster) GetScheme() *runtime.Scheme
- func (c *Cluster) Start(stop <-chan struct{}) error
- func (c *Cluster) WaitForCacheSync(stop <-chan struct{}) bool
- type Options
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 (*Cluster) AddEventHandler ¶
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 ¶ added in v0.3.0
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 ¶
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
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 ¶
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 ¶
Start starts the Cluster's cache and blocks, until an empty struct is sent to the stop channel.
func (*Cluster) WaitForCacheSync ¶
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.