Documentation ¶
Index ¶
- Constants
- Variables
- func AddInternalCluster(cluster clusterv1.Cluster) error
- func AddInternalClusterWithScout(cluster clusterv1.Cluster) error
- func AddInternalClusterWithScoutOpts(cluster clusterv1.Cluster, ...) error
- func ClusterWideKeyFunc(obj interface{}) (worker.QueueKey, error)
- func InitFakeMultiClusterMgrWithOpts(opts *fake.Options)
- func NewDefaultMultiVersionConverter(m Manager) conversion.MultiVersionConverter
- type DefaultMultiVersionConverter
- type FakerManagerImpl
- func (m *FakerManagerImpl) Add(cluster string, c *InternalCluster) error
- func (m *FakerManagerImpl) Del(cluster string) error
- func (m *FakerManagerImpl) FuzzyCopy() map[string]*FuzzyCluster
- func (m *FakerManagerImpl) Get(cluster string) (*InternalCluster, error)
- func (m *FakerManagerImpl) GetClient(cluster string) (client.Client, error)
- func (m *FakerManagerImpl) GetTransport(cluster string) (http.RoundTripper, error)
- func (m *FakerManagerImpl) ListClustersByType(t clusterType) []*InternalCluster
- func (m *FakerManagerImpl) ListClustersNameByType(t clusterType) []string
- func (m *FakerManagerImpl) ScoutFor(ctx context.Context, cluster string) error
- func (m *FakerManagerImpl) Version(cluster string) (*version.Info, error)
- type FuzzyCluster
- type InternalCluster
- type Manager
- type MultiClustersMgr
- func (m *MultiClustersMgr) Add(cluster string, c *InternalCluster) error
- func (m *MultiClustersMgr) Del(cluster string) error
- func (m *MultiClustersMgr) FuzzyCopy() map[string]*FuzzyCluster
- func (m *MultiClustersMgr) Get(cluster string) (*InternalCluster, error)
- func (m *MultiClustersMgr) GetClient(cluster string) (client.Client, error)
- func (m *MultiClustersMgr) GetTransport(cluster string) (http.RoundTripper, error)
- func (m *MultiClustersMgr) ListClustersByType(t clusterType) []*InternalCluster
- func (m *MultiClustersMgr) ListClustersNameByType(t clusterType) []string
- func (m *MultiClustersMgr) ScoutFor(ctx context.Context, cluster string) error
- func (m *MultiClustersMgr) Version(cluster string) (*version.Info, error)
- type SyncMgr
Constants ¶
const ( LocalCluster clusterType = iota PivotCluster MemberCluster AllCluster )
Variables ¶
var ManagerImpl = newMultiClusterMgr()
ManagerImpl instance implement interface, init local cluster at first.
Functions ¶
func AddInternalCluster ¶ added in v1.2.0
AddInternalCluster build internal cluster of cluster and add it to multi cluster manager without scout.
func AddInternalClusterWithScout ¶ added in v1.2.0
AddInternalClusterWithScout build internal cluster of cluster and add it to multi cluster manager with scout by default opts.
func AddInternalClusterWithScoutOpts ¶ added in v1.7.9
func AddInternalClusterWithScoutOpts(cluster clusterv1.Cluster, scoutInitialDelaySeconds, scoutWaitTimeoutSeconds int) error
AddInternalClusterWithScoutOpts build internal cluster of cluster and add it to multi cluster manager with scout opts.
func ClusterWideKeyFunc ¶ added in v1.2.0
ClusterWideKeyFunc generates a ClusterWideKey for object.
func InitFakeMultiClusterMgrWithOpts ¶ added in v1.2.0
InitFakeMultiClusterMgrWithOpts must be called at first in testing
func NewDefaultMultiVersionConverter ¶ added in v1.2.0
func NewDefaultMultiVersionConverter(m Manager) conversion.MultiVersionConverter
Types ¶
type DefaultMultiVersionConverter ¶ added in v1.2.0
type DefaultMultiVersionConverter struct {
// contains filtered or unexported fields
}
func (*DefaultMultiVersionConverter) GetVersionConvert ¶ added in v1.2.0
func (m *DefaultMultiVersionConverter) GetVersionConvert(cluster string) (*conversion.VersionConverter, error)
type FakerManagerImpl ¶ added in v1.2.0
type FakerManagerImpl struct { sync.RWMutex Clusters map[string]*InternalCluster }
FakerManagerImpl implements Manager
func (*FakerManagerImpl) Add ¶ added in v1.2.0
func (m *FakerManagerImpl) Add(cluster string, c *InternalCluster) error
func (*FakerManagerImpl) Del ¶ added in v1.2.0
func (m *FakerManagerImpl) Del(cluster string) error
func (*FakerManagerImpl) FuzzyCopy ¶ added in v1.2.0
func (m *FakerManagerImpl) FuzzyCopy() map[string]*FuzzyCluster
func (*FakerManagerImpl) Get ¶ added in v1.2.0
func (m *FakerManagerImpl) Get(cluster string) (*InternalCluster, error)
func (*FakerManagerImpl) GetClient ¶ added in v1.2.0
func (m *FakerManagerImpl) GetClient(cluster string) (client.Client, error)
func (*FakerManagerImpl) GetTransport ¶ added in v1.6.0
func (m *FakerManagerImpl) GetTransport(cluster string) (http.RoundTripper, error)
func (*FakerManagerImpl) ListClustersByType ¶ added in v1.2.0
func (m *FakerManagerImpl) ListClustersByType(t clusterType) []*InternalCluster
func (*FakerManagerImpl) ListClustersNameByType ¶ added in v1.2.1
func (m *FakerManagerImpl) ListClustersNameByType(t clusterType) []string
type FuzzyCluster ¶ added in v1.2.0
type FuzzyCluster struct { Name string Config *rest.Config Client client.Client RawCluster *clusterv1.Cluster }
FuzzyCluster be exported for test
type InternalCluster ¶ added in v1.2.0
type InternalCluster struct { // Name the cluster name Name string // Type of cluster Type clusterType // Client holds all the clients needed Client client.Client // Scout knows the health status of cluster and keep watch Scout *scout.Scout // Config bind to a real cluster Config *rest.Config // Version the k8s Version about internal cluster Version *version.Info // RawCluster holds raw cluster RawCluster *clusterv1.Cluster // StopCh for closing channel when delete cluster, goroutine // of cache and scout will exit gracefully. StopCh chan struct{} // contains filtered or unexported fields }
InternalCluster represent a cluster runtime contains client and internal warden.
func NewInternalCluster ¶ added in v1.2.0
func NewInternalCluster(cluster clusterv1.Cluster) (*InternalCluster, error)
type Manager ¶ added in v1.2.0
type Manager interface { // Add runtime cache in memory Add(cluster string, internalCluster *InternalCluster) error Get(cluster string) (*InternalCluster, error) Del(cluster string) error // Version the k8s version about cluster Version(cluster string) (*version.Info, 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 by name GetClient(cluster string) (client.Client, error) GetTransport(cluster string) (http.RoundTripper, error) // ListClustersByType list clusters by given type ListClustersByType(t clusterType) []*InternalCluster // ListClustersNameByType list cluster names by given type ListClustersNameByType(t clusterType) []string }
Manager access to internal cluster
type MultiClustersMgr ¶ added in v1.2.0
type MultiClustersMgr struct { sync.RWMutex Clusters map[string]*InternalCluster }
MultiClustersMgr a memory cache for runtime cluster.
func (*MultiClustersMgr) Add ¶ added in v1.2.0
func (m *MultiClustersMgr) Add(cluster string, c *InternalCluster) error
func (*MultiClustersMgr) Del ¶ added in v1.2.0
func (m *MultiClustersMgr) Del(cluster string) error
func (*MultiClustersMgr) FuzzyCopy ¶ added in v1.2.0
func (m *MultiClustersMgr) FuzzyCopy() map[string]*FuzzyCluster
FuzzyCopy copy all internal clusters when runtime except local cluster
func (*MultiClustersMgr) Get ¶ added in v1.2.0
func (m *MultiClustersMgr) Get(cluster string) (*InternalCluster, error)
func (*MultiClustersMgr) GetClient ¶ added in v1.2.0
func (m *MultiClustersMgr) GetClient(cluster string) (client.Client, error)
func (*MultiClustersMgr) GetTransport ¶ added in v1.6.0
func (m *MultiClustersMgr) GetTransport(cluster string) (http.RoundTripper, error)
func (*MultiClustersMgr) ListClustersByType ¶ added in v1.2.0
func (m *MultiClustersMgr) ListClustersByType(t clusterType) []*InternalCluster
ListClustersByType get clusters by given type return nil if found no clusters with type.
func (*MultiClustersMgr) ListClustersNameByType ¶ added in v1.2.1
func (m *MultiClustersMgr) ListClustersNameByType(t clusterType) []string
ListClustersNameByType get cluster names by given type return nil if found no clusters with type.
type SyncMgr ¶ added in v1.2.0
type SyncMgr struct { Informer cache.Informer Worker worker.Interface // ScoutWaitTimeoutSeconds that heartbeat not receive timeout ScoutWaitTimeoutSeconds int // ScoutInitialDelaySeconds the time that wait for warden start ScoutInitialDelaySeconds int // contains filtered or unexported fields }
SyncMgr only running when process as subsidiary
func NewSyncMgr ¶ added in v1.2.0
func NewSyncMgrWithDefaultSetting ¶ added in v1.3.0
func NewSyncMgrWithScoutSetting ¶ added in v1.7.9
func (*SyncMgr) OnClusterAdd ¶ added in v1.2.0
func (m *SyncMgr) OnClusterAdd(obj interface{})
func (*SyncMgr) OnClusterDelete ¶ added in v1.2.0
func (m *SyncMgr) OnClusterDelete(obj interface{})
func (*SyncMgr) OnClusterUpdate ¶ added in v1.2.0
func (m *SyncMgr) OnClusterUpdate(oldObj, newObj interface{})
func (*SyncMgr) ReconcileCluster ¶ added in v1.2.0
ReconcileCluster sync cluster during multi KubeCube instance