multicluster

package
v0.0.0-...-713cd5d Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MultiClusterSecretLabel = "istio/multiCluster"
)

Variables

This section is empty.

Functions

func DefaultBuildClientsFromConfig

func DefaultBuildClientsFromConfig(kubeConfig []byte, clusterID cluster.ID, configOverrides ...func(*rest.Config)) (kube.Client, error)

DefaultBuildClientsFromConfig creates kube.Clients from the provided kubeconfig. This is overridden for testing only

Types

type ACTION

type ACTION int
const (
	Add ACTION = iota
	Update
)

func (ACTION) String

func (a ACTION) String() string

type ClientBuilder

type ClientBuilder = func(kubeConfig []byte, clusterId cluster.ID, configOverrides ...func(*rest.Config)) (kube.Client, error)

ClientBuilder builds a new kube.Client from a kubeconfig. Mocked out for testing

type Cluster

type Cluster struct {
	// ID of the cluster.
	ID cluster.ID
	// Client for accessing the cluster.
	Client kube.Client
	// contains filtered or unexported fields
}

Cluster defines cluster struct

func (*Cluster) Closed

func (c *Cluster) Closed() bool

func (*Cluster) HasSynced

func (c *Cluster) HasSynced() bool

func (*Cluster) Run

func (c *Cluster) Run(mesh mesh.Watcher, handlers []handler, action ACTION)

Run starts the cluster's informers and waits for caches to sync. Once caches are synced, we mark the cluster synced. This should be called after each of the handlers have registered informers, and should be run in a goroutine.

func (*Cluster) Stop

func (c *Cluster) Stop()

Stop closes the stop channel, if is safe to be called multi times.

func (*Cluster) SyncDidTimeout

func (c *Cluster) SyncDidTimeout() bool

type ClusterStore

type ClusterStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ClusterStore is a collection of clusters

func (*ClusterStore) All

func (c *ClusterStore) All() map[string]map[cluster.ID]*Cluster

All returns a copy of the current remote clusters.

func (*ClusterStore) Contains

func (c *ClusterStore) Contains(clusterID cluster.ID) bool

func (*ClusterStore) Delete

func (c *ClusterStore) Delete(secretKey string, clusterID cluster.ID)

func (*ClusterStore) Get

func (c *ClusterStore) Get(secretKey string, clusterID cluster.ID) *Cluster

func (*ClusterStore) GetByID

func (c *ClusterStore) GetByID(clusterID cluster.ID) *Cluster

func (*ClusterStore) GetExistingClustersFor

func (c *ClusterStore) GetExistingClustersFor(secretKey string) []*Cluster

GetExistingClustersFor return existing clusters registered for the given secret

func (*ClusterStore) HasSynced

func (c *ClusterStore) HasSynced() bool

func (*ClusterStore) Len

func (c *ClusterStore) Len() int

func (*ClusterStore) Store

func (c *ClusterStore) Store(secretKey string, clusterID cluster.ID, value *Cluster)

type Component

type Component[T ComponentConstraint] struct {
	// contains filtered or unexported fields
}

func BuildMultiClusterComponent

func BuildMultiClusterComponent[T ComponentConstraint](c ComponentBuilder, constructor func(cluster *Cluster) T) *Component[T]

BuildMultiClusterComponent constructs a new multicluster component. For each cluster, the constructor will be called. If the cluster is removed, the T.Close() method will be called. Constructors MUST not do blocking IO; they will block other operations. During a cluster update, a new component is constructed before the old one is removed for seamless migration.

func (*Component[T]) All

func (m *Component[T]) All() []T

func (*Component[T]) ForCluster

func (m *Component[T]) ForCluster(clusterID cluster.ID) *T

func (*Component[T]) HasSynced

func (m *Component[T]) HasSynced() bool

type ComponentBuilder

type ComponentBuilder interface {
	// contains filtered or unexported methods
}

type ComponentConstraint

type ComponentConstraint interface {
	Close()
	HasSynced() bool
}

type Controller

type Controller struct {
	ClientBuilder ClientBuilder
	// contains filtered or unexported fields
}

Controller is the controller implementation for Secret resources

func NewController

func NewController(kubeclientset kube.Client, namespace string, clusterID cluster.ID,
	meshWatcher mesh.Watcher, configOverrides ...func(*rest.Config),
) *Controller

NewController returns a new secret controller

func (*Controller) GetRemoteKubeClient

func (c *Controller) GetRemoteKubeClient(clusterID cluster.ID) kubernetes.Interface

func (*Controller) HasSynced

func (c *Controller) HasSynced() bool

func (*Controller) ListRemoteClusters

func (c *Controller) ListRemoteClusters() []cluster.DebugInfo

ListRemoteClusters provides debug info about connected remote clusters.

func (*Controller) Run

func (c *Controller) Run(stopCh <-chan struct{}) error

Run starts the controller until it receives a message over stopCh

type Fake

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

func NewFakeController

func NewFakeController() *Fake

func (*Fake) Add

func (f *Fake) Add(id cluster.ID, client kube.Client, stop chan struct{})

func (*Fake) Delete

func (f *Fake) Delete(id cluster.ID)

type KclientComponent

type KclientComponent[T controllers.ComparableObject] struct {
	// contains filtered or unexported fields
}

func BuildMultiClusterKclientComponent

func BuildMultiClusterKclientComponent[T controllers.ComparableObject](c ComponentBuilder, filter kubetypes.Filter) *KclientComponent[T]

BuildMultiClusterKclientComponent builds a simple Component that just wraps a single kclient.Client

func (*KclientComponent[T]) All

func (m *KclientComponent[T]) All() []kclient.Client[T]

func (*KclientComponent[T]) ForCluster

func (m *KclientComponent[T]) ForCluster(clusterID cluster.ID) kclient.Client[T]

ForCluster returns the client for the requests cluster Note: this may return nil.

Jump to

Keyboard shortcuts

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