manager

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 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 AddInternalCluster added in v1.0.3

func AddInternalCluster(cluster clusterv1.Cluster) error

AddInternalCluster build internal cluster of cluster and add it to multi cluster manager

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 holds all the clients needed
	Client kubernetes.Client

	// Scout knows the health status of cluster and keep watch
	Scout *scout.Scout

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

	// RawConfig holds raw kubeconfig
	RawConfig []byte

	// StopCh for closing 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