clusters

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClusterNotFound    = errors.New("cluster not found")
	ErrControllerNotFound = errors.New("controller not found")
)

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(ctx context.Context, name string, k8sConfig *rest.Config, log logr.Logger, opts ...Option) (*Cluster, error)

func (*Cluster) AddController

func (c *Cluster) AddController(controller ManagedController) error

func (*Cluster) AddFeature

func (c *Cluster) AddFeature(feature ClusterFeature)

func (*Cluster) AddOnAliveFunc

func (c *Cluster) AddOnAliveFunc(f ClusterFunc)

func (*Cluster) AddOnDeadFunc

func (c *Cluster) AddOnDeadFunc(f ClusterFunc)

func (*Cluster) GetClusterID

func (c *Cluster) GetClusterID() string

func (*Cluster) GetController

func (c *Cluster) GetController(name string) ManagedController

func (*Cluster) GetControllerByGVK

func (c *Cluster) GetControllerByGVK(gvk resources.GroupVersionKind) ManagedController

func (*Cluster) GetControllers

func (c *Cluster) GetControllers() ManagedControllers

func (*Cluster) GetKubeconfig

func (c *Cluster) GetKubeconfig() []byte

func (*Cluster) GetManager

func (c *Cluster) GetManager() ctrl.Manager

func (*Cluster) GetName

func (c *Cluster) GetName() string

func (*Cluster) GetPendingControllers

func (c *Cluster) GetPendingControllers() ManagedControllers

func (*Cluster) GetSecretID

func (c *Cluster) GetSecretID() *string

func (*Cluster) HasController

func (c *Cluster) HasController(name string) bool

func (*Cluster) IsAlive

func (c *Cluster) IsAlive() bool

func (*Cluster) IsManagerRunning

func (c *Cluster) IsManagerRunning() bool

func (*Cluster) ManagerStopped

func (c *Cluster) ManagerStopped() <-chan struct{}

func (*Cluster) RemoveController

func (c *Cluster) RemoveController(controller ManagedController)

func (*Cluster) RemoveControllerByName

func (c *Cluster) RemoveControllerByName(name string)

func (*Cluster) RemoveFeature

func (c *Cluster) RemoveFeature(uid string)

func (*Cluster) Start

func (c *Cluster) Start() error

func (*Cluster) StartManager

func (c *Cluster) StartManager() error

func (*Cluster) Stop

func (c *Cluster) Stop()

func (*Cluster) StopManager

func (c *Cluster) StopManager()

func (*Cluster) Stopped

func (c *Cluster) Stopped() <-chan struct{}

type ClusterFeature

type ClusterFeature interface {
	GetUID() string
	GetName() string
	GetLabels() map[string]string
}

func NewClusterFeature

func NewClusterFeature(uid, name string, labels map[string]string) ClusterFeature

type ClusterFeatureRequirement

type ClusterFeatureRequirement struct {
	Name             string
	MatchLabels      map[string]string
	MatchExpressions []metav1.LabelSelectorRequirement
}

func (ClusterFeatureRequirement) Match

func (r ClusterFeatureRequirement) Match(features map[string]ClusterFeature) bool

type ClusterFunc

type ClusterFunc func(c *Cluster) error

type ManagedController

type ManagedController interface {
	SetLogger(l logr.Logger)
	GetReconciler() ManagedReconciler
	GetName() string
	Stop()
	Stopped() <-chan struct{}
	Start(ctx context.Context, mgr ctrl.Manager) error
	GetRequiredClusterFeatures() []ClusterFeatureRequirement
	GetClient() client.Client
}

func NewManagedController

func NewManagedController(name string, r ManagedReconciler, l logr.Logger, options ...ManagedControllerOption) ManagedController

type ManagedControllerOption

type ManagedControllerOption func(*managedController)

func WithRequiredClusterFeatures

func WithRequiredClusterFeatures(features ...ClusterFeatureRequirement) ManagedControllerOption

type ManagedControllers

type ManagedControllers map[string]ManagedController

type ManagedReconciler

type ManagedReconciler interface {
	reconcile.Reconciler

	PreCheck(ctx context.Context, client client.Client) error
	DoCleanup()
	GetName() string
	GetManager() ctrl.Manager
	SetManager(mgr ctrl.Manager)
	GetRecorder() record.EventRecorder
	GetContext() context.Context
	SetContext(ctx context.Context)
	GetLogger() logr.Logger
	SetLogger(l logr.Logger)
	GetClient() client.Client
	SetClient(client client.Client)
	Start(ctx context.Context) error
	SetScheme(scheme *runtime.Scheme)
	SetupWithController(ctx context.Context, ctrl controller.Controller) error
	SetupWithManager(ctx context.Context, mgr ctrl.Manager) error
}

func NewManagedReconciler

func NewManagedReconciler(name string, log logr.Logger) ManagedReconciler

type ManagedReconcilerBase

type ManagedReconcilerBase struct {
	// contains filtered or unexported fields
}

func (*ManagedReconcilerBase) DoCleanup

func (r *ManagedReconcilerBase) DoCleanup()

func (*ManagedReconcilerBase) GetClient

func (r *ManagedReconcilerBase) GetClient() client.Client

func (*ManagedReconcilerBase) GetContext

func (r *ManagedReconcilerBase) GetContext() context.Context

func (*ManagedReconcilerBase) GetLogger

func (r *ManagedReconcilerBase) GetLogger() logr.Logger

func (*ManagedReconcilerBase) GetManager

func (r *ManagedReconcilerBase) GetManager() ctrl.Manager

func (*ManagedReconcilerBase) GetName

func (r *ManagedReconcilerBase) GetName() string

func (*ManagedReconcilerBase) GetRecorder

func (r *ManagedReconcilerBase) GetRecorder() record.EventRecorder

func (*ManagedReconcilerBase) PreCheck

func (r *ManagedReconcilerBase) PreCheck(ctx context.Context, client client.Client) error

func (*ManagedReconcilerBase) Reconcile

func (r *ManagedReconcilerBase) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ManagedReconcilerBase) SetClient

func (r *ManagedReconcilerBase) SetClient(client client.Client)

func (*ManagedReconcilerBase) SetContext

func (r *ManagedReconcilerBase) SetContext(ctx context.Context)

func (*ManagedReconcilerBase) SetLogger

func (r *ManagedReconcilerBase) SetLogger(l logr.Logger)

func (*ManagedReconcilerBase) SetManager

func (r *ManagedReconcilerBase) SetManager(mgr ctrl.Manager)

func (*ManagedReconcilerBase) SetScheme

func (r *ManagedReconcilerBase) SetScheme(scheme *runtime.Scheme)

func (*ManagedReconcilerBase) SetupWithController

func (r *ManagedReconcilerBase) SetupWithController(ctx context.Context, ctrl controller.Controller) error

func (*ManagedReconcilerBase) SetupWithManager

func (r *ManagedReconcilerBase) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

func (*ManagedReconcilerBase) Start

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(ctx context.Context, options ...ManagerOption) *Manager

func (*Manager) Add

func (m *Manager) Add(cluster *Cluster) error

func (*Manager) AddOnAfterAddFunc

func (m *Manager) AddOnAfterAddFunc(f func(c *Cluster), ids ...string)

func (*Manager) AddOnAfterDeleteFunc

func (m *Manager) AddOnAfterDeleteFunc(f func(), ids ...string)

func (*Manager) AddOnBeforeAddFunc

func (m *Manager) AddOnBeforeAddFunc(f func(c *Cluster), ids ...string)

func (*Manager) AddOnBeforeDeleteFunc

func (m *Manager) AddOnBeforeDeleteFunc(f func(c *Cluster), ids ...string)

func (*Manager) DeleteOnAfterAddFunc

func (m *Manager) DeleteOnAfterAddFunc(id string)

func (*Manager) DeleteOnAfterDeleteFunc

func (m *Manager) DeleteOnAfterDeleteFunc(id string)

func (*Manager) DeleteOnBeforeAddFunc

func (m *Manager) DeleteOnBeforeAddFunc(id string)

func (*Manager) DeleteOnBeforeDeleteFunc

func (m *Manager) DeleteOnBeforeDeleteFunc(id string)

func (*Manager) Exists

func (m *Manager) Exists(name string) bool

func (*Manager) Get

func (m *Manager) Get(name string) (*Cluster, error)

func (*Manager) GetAliveClustersByID

func (m *Manager) GetAliveClustersByID() map[string]*Cluster

func (*Manager) GetAll

func (m *Manager) GetAll() map[string]*Cluster

func (*Manager) Remove

func (m *Manager) Remove(cluster *Cluster) error

func (*Manager) Stopped

func (m *Manager) Stopped() <-chan struct{}

type ManagerOption

type ManagerOption func(m *Manager)

func WithOnAfterAddFunc

func WithOnAfterAddFunc(f func(c *Cluster), ids ...string) ManagerOption

func WithOnAfterDeleteFunc

func WithOnAfterDeleteFunc(f func(), ids ...string) ManagerOption

func WithOnBeforeAddFunc

func WithOnBeforeAddFunc(f func(c *Cluster), ids ...string) ManagerOption

func WithOnBeforeDeleteFunc

func WithOnBeforeDeleteFunc(f func(c *Cluster), ids ...string) ManagerOption

type Option

type Option func(*Cluster)

func WithCtrlOption

func WithCtrlOption(options ctrl.Options) Option

func WithKubeconfig

func WithKubeconfig(kubeconfig []byte) Option

func WithLivenessCheckInterval

func WithLivenessCheckInterval(interval time.Duration) Option

func WithOnAliveFunc

func WithOnAliveFunc(f func(c *Cluster) error) Option

func WithOnDeadFunc

func WithOnDeadFunc(f func(c *Cluster) error) Option

func WithScheme

func WithScheme(scheme *runtime.Scheme) Option

func WithSecretID

func WithSecretID(secretID string) Option

Jump to

Keyboard shortcuts

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