multicluster

package
v0.22.21 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 111

Documentation

Index

Constants

View Source
const (
	// LocalCluster is the clusterName for the local cluster
	// (the main cluster from which registered clusters are processed by the ClusterWatcher).
	LocalCluster = ""
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(managers ManagerSet) *mcClient

Types

type Client

type Client interface {
	// List available clusters
	ClusterSet

	// Cluster returns a client.Client for the given cluster.
	Cluster(name string) (client.Client, error)
}

Client exposes client.Client for multiple clusters.

type ClusterHandler

type ClusterHandler interface {
	// AddCluster is called when a new cluster is identified by a cluster watch.
	// The provided context is cancelled when a cluster is removed, so any teardown behavior for removed clusters
	// should take place when ctx is cancelled.
	AddCluster(ctx context.Context, cluster string, mgr manager.Manager)
}

ClusterHandler is passed to RunClusterWatcher to handle select cluster events. It is implemented internally by skv2 components but can be implemented by the user for specialized use cases.

type ClusterRemovedHandler

type ClusterRemovedHandler interface {
	// RemoveCluster is called when a cluster watch identifies a cluster as deleted.
	RemoveCluster(cluster string)
}

ClusterRemovedHandler can be implemented by ClusterHandlers to perform cleanup when a cluster is deleted. NOTE: in most cases, cleanup should be handled when the cluster manager's context is cancelled without the need for implementing ClusterRemovedHandler.

type ClusterSet

type ClusterSet interface {
	// List the clusters (sorted) currently known to the set
	ListClusters() []string
}

ManagerSet maintains a manager for every cluster in the system.

type ClusterWatcher

type ClusterWatcher interface {
	// Run starts a watch for KubeConfig secrets on the cluster managed by the given manager.Manager.
	// Note that Run will call Start on the given manager and run all registered ClusterHandlers.
	Run(management manager.Manager) error
	// RegisterClusterHandler adds a ClusterHandler to the ClusterWatcher.
	RegisterClusterHandler(handler ClusterHandler)
}

ClusterWatcher watches for KubeConfig secrets on the management cluster. It is responsible for starting cluster managers and calling ClusterHandler functions.

type DeletionReconciler

type DeletionReconciler interface {
	// we received a reconcile request for an object that was removed from the cache
	// requeue the object if returning an error,
	ReconcileDeletion(cluster string, request reconcile.Request) error
}

type Interface added in v0.7.17

type Interface interface {
	ClusterWatcher
	ManagerSet
}

the multicluster Interface provides a handle to interacting with multiple clusters. the multicluster watcher implements this interface.

type Loop

type Loop interface {
	// AddReconciler adds a reconciler to a slice of reconcilers that will be run against
	AddReconciler(ctx context.Context, reconciler Reconciler, predicates ...predicate.Predicate)
}

Loop runs resource reconcilers until the context gets cancelled

type ManagerSet

type ManagerSet interface {
	// Cluster returns a manager for the given cluster, or an error if one does not exist.
	Cluster(cluster string) (manager.Manager, error)

	// Lists clusters
	ClusterSet
}

ManagerSet maintains a manager for every cluster in the system.

type Reconciler

type Reconciler interface {
	// reconcile an object
	// requeue the object if returning an error, or a non-zero "requeue-after" duration
	Reconcile(cluster string, object ezkube.Object) (reconcile.Result, error)
}

Directories

Path Synopsis
cloud/mocks
Package mock_cloud is a generated GoMock package.
Package mock_cloud is a generated GoMock package.
mocks
Package mock_discovery is a generated GoMock package.
Package mock_discovery is a generated GoMock package.
internal
k8s/admissionregistration.k8s.io/v1
Definitions for the Kubernetes types
Definitions for the Kubernetes types
k8s/admissionregistration.k8s.io/v1/controller
Definitions for the Kubernetes Controllers
Definitions for the Kubernetes Controllers
k8s/admissionregistration.k8s.io/v1/controller/mocks
Package mock_controller is a generated GoMock package.
Package mock_controller is a generated GoMock package.
k8s/admissionregistration.k8s.io/v1/mocks
Package mock_v1 is a generated GoMock package.
Package mock_v1 is a generated GoMock package.
k8s/admissionregistration.k8s.io/v1/sets/mocks
Package mock_v1sets is a generated GoMock package.
Package mock_v1sets is a generated GoMock package.
k8s/apiextensions.k8s.io/v1
Definitions for the Kubernetes types
Definitions for the Kubernetes types
k8s/apiextensions.k8s.io/v1/controller
Definitions for the Kubernetes Controllers
Definitions for the Kubernetes Controllers
k8s/apiextensions.k8s.io/v1/controller/mocks
Package mock_controller is a generated GoMock package.
Package mock_controller is a generated GoMock package.
k8s/apiextensions.k8s.io/v1/mocks
Package mock_v1 is a generated GoMock package.
Package mock_v1 is a generated GoMock package.
k8s/apiextensions.k8s.io/v1/sets/mocks
Package mock_v1sets is a generated GoMock package.
Package mock_v1sets is a generated GoMock package.
k8s/apiextensions.k8s.io/v1beta1
Definitions for the Kubernetes types
Definitions for the Kubernetes types
k8s/apiextensions.k8s.io/v1beta1/controller
Definitions for the Kubernetes Controllers
Definitions for the Kubernetes Controllers
k8s/apiextensions.k8s.io/v1beta1/controller/mocks
Package mock_controller is a generated GoMock package.
Package mock_controller is a generated GoMock package.
k8s/apiextensions.k8s.io/v1beta1/mocks
Package mock_v1beta1 is a generated GoMock package.
Package mock_v1beta1 is a generated GoMock package.
k8s/apiextensions.k8s.io/v1beta1/sets/mocks
Package mock_v1beta1sets is a generated GoMock package.
Package mock_v1beta1sets is a generated GoMock package.
k8s/certificates.k8s.io/v1beta1
Definitions for the Kubernetes types
Definitions for the Kubernetes types
k8s/certificates.k8s.io/v1beta1/controller
Definitions for the Kubernetes Controllers
Definitions for the Kubernetes Controllers
k8s/certificates.k8s.io/v1beta1/controller/mocks
Package mock_controller is a generated GoMock package.
Package mock_controller is a generated GoMock package.
k8s/certificates.k8s.io/v1beta1/mocks
Package mock_v1beta1 is a generated GoMock package.
Package mock_v1beta1 is a generated GoMock package.
k8s/certificates.k8s.io/v1beta1/sets/mocks
Package mock_v1beta1sets is a generated GoMock package.
Package mock_v1beta1sets is a generated GoMock package.
k8s/core/v1
Definitions for the Kubernetes types
Definitions for the Kubernetes types
k8s/core/v1/controller
Definitions for the Kubernetes Controllers
Definitions for the Kubernetes Controllers
k8s/core/v1/controller/mocks
Package mock_controller is a generated GoMock package.
Package mock_controller is a generated GoMock package.
k8s/core/v1/mocks
Package mock_v1 is a generated GoMock package.
Package mock_v1 is a generated GoMock package.
k8s/core/v1/sets/mocks
Package mock_v1sets is a generated GoMock package.
Package mock_v1sets is a generated GoMock package.
k8s/rbac.authorization.k8s.io/v1
Definitions for the Kubernetes types
Definitions for the Kubernetes types
k8s/rbac.authorization.k8s.io/v1/controller
Definitions for the Kubernetes Controllers
Definitions for the Kubernetes Controllers
k8s/rbac.authorization.k8s.io/v1/controller/mocks
Package mock_controller is a generated GoMock package.
Package mock_controller is a generated GoMock package.
k8s/rbac.authorization.k8s.io/v1/mocks
Package mock_v1 is a generated GoMock package.
Package mock_v1 is a generated GoMock package.
k8s/rbac.authorization.k8s.io/v1/sets/mocks
Package mock_v1sets is a generated GoMock package.
Package mock_v1sets is a generated GoMock package.
mocks
Package mock_kubeconfig is a generated GoMock package.
Package mock_kubeconfig is a generated GoMock package.
internal/mocks
Package mock_internal is a generated GoMock package.
Package mock_internal is a generated GoMock package.
mock_clientcmd
Package mock_clientcmd is a generated GoMock package.
Package mock_clientcmd is a generated GoMock package.
mocks
Package mock_register is a generated GoMock package.
Package mock_register is a generated GoMock package.

Jump to

Keyboard shortcuts

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