manager

package
v1.0.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MultiClusterMgr = newMultiClusterMgr()

MultiClusterMgr instance implement interface, init pivot cluster at first.

Functions

func StartMultiClusterSync

func StartMultiClusterSync(ctx context.Context)

StartMultiClusterSync as a backend to sync cluster info to memory. Closed when as a leader.

Types

type FuzzyCluster

type FuzzyCluster struct {
	Name   string
	Config *rest.Config
	Client kubernetes.Client
}

FuzzyCluster be exported for test

type InternalCluster

type InternalCluster struct {
	Client kubernetes.Client
	Scout  *scout.Scout

	// Config bind to a real cluster
	Config *rest.Config

	// close channel when delete cluster, goroutine
	// of informer and scout will exit gracefully.
	StopCh chan struct{}
}

InternalCluster represent a cluster runtime contains client and internal warden.

type MultiClustersManager

type MultiClustersManager interface {
	// Add runtime cache in memory
	Add(cluster string, internalCluster *InternalCluster) error
	Get(cluster string) (*InternalCluster, error)
	Del(cluster string) error

	// FuzzyCopy return fuzzy cluster of raw
	FuzzyCopy() map[string]*FuzzyCluster

	// ScoutFor scout heartbeat for warden
	ScoutFor(ctx context.Context, cluster string) error

	// GetClient get client for cluster
	GetClient(cluster string) (kubernetes.Client, error)
}

MultiClustersManager access to internal cluster

type MultiClustersMgr

type MultiClustersMgr struct {
	sync.RWMutex
	Clusters map[string]*InternalCluster
}

MultiClustersMgr a memory cache for runtime cluster.

func (*MultiClustersMgr) Add

func (m *MultiClustersMgr) Add(cluster string, c *InternalCluster) error

func (*MultiClustersMgr) Del

func (m *MultiClustersMgr) Del(cluster string) error

func (*MultiClustersMgr) FuzzyCopy

func (m *MultiClustersMgr) FuzzyCopy() map[string]*FuzzyCluster

func (*MultiClustersMgr) Get

func (m *MultiClustersMgr) Get(cluster string) (*InternalCluster, error)

func (*MultiClustersMgr) GetClient

func (m *MultiClustersMgr) GetClient(cluster string) (kubernetes.Client, error)

func (*MultiClustersMgr) ScoutFor

func (m *MultiClustersMgr) ScoutFor(ctx context.Context, cluster string) error

ScoutFor starts watch for warden intelligence

Jump to

Keyboard shortcuts

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