Documentation ¶
Index ¶
- Constants
- Variables
- type Cluster
- type ClusterHandler
- type ClusterStore
- func (c *ClusterStore) All() map[string]map[cluster.ID]*Cluster
- func (c *ClusterStore) Contains(clusterID cluster.ID) bool
- func (c *ClusterStore) Delete(secretKey string, clusterID cluster.ID)
- func (c *ClusterStore) Get(secretKey string, clusterID cluster.ID) *Cluster
- func (c *ClusterStore) GetByID(clusterID cluster.ID) *Cluster
- func (c *ClusterStore) GetExistingClustersFor(secretKey string) []*Cluster
- func (c *ClusterStore) Len() int
- func (c *ClusterStore) Store(secretKey string, clusterID cluster.ID, value *Cluster)
- type Controller
Constants ¶
const (
MultiClusterSecretLabel = "istio/multiCluster"
)
Variables ¶
var BuildClientsFromConfig = func(kubeConfig []byte) (kube.Client, error) { if len(kubeConfig) == 0 { return nil, errors.New("kubeconfig is empty") } rawConfig, err := clientcmd.Load(kubeConfig) if err != nil { return nil, fmt.Errorf("kubeconfig cannot be loaded: %v", err) } if err := clientcmd.Validate(*rawConfig); err != nil { return nil, fmt.Errorf("kubeconfig is not valid: %v", err) } if err := sanitizeKubeConfig(*rawConfig, features.InsecureKubeConfigOptions); err != nil { return nil, fmt.Errorf("kubeconfig is not allowed: %v", err) } clientConfig := clientcmd.NewDefaultClientConfig(*rawConfig, &clientcmd.ConfigOverrides{}) clients, err := kube.NewClient(clientConfig) if err != nil { return nil, fmt.Errorf("failed to create kube clients: %v", err) } return clients, nil }
BuildClientsFromConfig creates kube.Clients from the provided kubeconfig. This is overridden for testing only
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { // ID of the cluster. ID cluster.ID // SyncTimeout is marked after features.RemoteClusterTimeout. SyncTimeout *atomic.Bool // Client for accessing the cluster. Client kube.Client // contains filtered or unexported fields }
Cluster defines cluster struct
func (*Cluster) Run ¶
func (r *Cluster) Run()
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 (r *Cluster) Stop() <-chan struct{}
Stop channel which is closed when the cluster is removed or the Controller that created the client is stopped. Client.RunAndWait is called using this channel.
func (*Cluster) SyncDidTimeout ¶
type ClusterHandler ¶
type ClusterStore ¶
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) Get ¶
func (c *ClusterStore) Get(secretKey string, 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) Len ¶
func (c *ClusterStore) Len() int
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the controller implementation for Secret resources
func NewController ¶
func NewController(kubeclientset kube.Client, namespace string, localClusterID cluster.ID) *Controller
NewController returns a new secret controller
func (*Controller) AddHandler ¶
func (c *Controller) AddHandler(h ClusterHandler)
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