Documentation
¶
Index ¶
Constants ¶
View Source
const LocalCluster = ""
LocalCluster is the name of the local cluster.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface {
// Add will set requested dependencies on the component, and cause the component to be
// started when Start is called.
// Depending on if a Runnable implements LeaderElectionRunnable interface, a Runnable can be run in either
// non-leaderelection mode (always running) or leader election mode (managed by leader election if enabled).
Add(Runnable) error
// Elected is closed when this manager is elected leader of a group of
// managers, either because it won a leader election or because no leader
// election was configured.
Elected() <-chan struct{}
// AddMetricsServerExtraHandler adds an extra handler served on path to the http server that serves metrics.
// Might be useful to register some diagnostic endpoints e.g. pprof.
//
// Note that these endpoints are meant to be sensitive and shouldn't be exposed publicly.
//
// If the simple path -> handler mapping offered here is not enough,
// a new http server/listener should be added as Runnable to the manager via Add method.
AddMetricsServerExtraHandler(path string, handler http.Handler) error
// AddHealthzCheck allows you to add Healthz checker
AddHealthzCheck(name string, check healthz.Checker) error
// AddReadyzCheck allows you to add Readyz checker
AddReadyzCheck(name string, check healthz.Checker) error
// Start starts all registered Controllers and blocks until the context is cancelled.
// Returns an error if there is an error starting any controller.
//
// If LeaderElection is used, the binary must be exited immediately after this returns,
// otherwise components that need leader election might continue to run after the leader
// lock was lost.
Start(ctx context.Context) error
// GetWebhookServer returns a webhook.Server
GetWebhookServer() webhook.Server
// GetLogger returns this manager's logger.
GetLogger() logr.Logger
// GetControllerOptions returns controller global configuration options.
GetControllerOptions() config.Controller
// GetCluster returns a cluster for the given identifying cluster name. Get
// returns an existing cluster if it has been created before.
// If no cluster is known to the provider under the given cluster name,
// an error should be returned.
GetCluster(ctx context.Context, clusterName string) (cluster.Cluster, error)
// ClusterFromContext returns the default cluster set in the context.
ClusterFromContext(ctx context.Context) (cluster.Cluster, error)
// GetManager returns a manager for the given cluster name.
GetManager(ctx context.Context, clusterName string) (manager.Manager, error)
// GetLocalManager returns the underlying controller-runtime manager of the
// host. This is equivalent to GetManager(LocalCluster).
GetLocalManager() manager.Manager
// GetProvider returns the multicluster provider, or nil if it is not set.
GetProvider() multicluster.Provider
// GetFieldIndexer returns a client.FieldIndexer that adds indexes to the
// multicluster provider (if set) and the local manager.
GetFieldIndexer() client.FieldIndexer
multicluster.Aware
}
Manager is a multi-cluster-aware manager, like the controller-runtime Cluster, but without the direct embedding of cluster.Cluster.
func New ¶
func New(config *rest.Config, provider multicluster.Provider, opts manager.Options, mcOpts ...Option) (Manager, error)
New returns a new Manager for creating Controllers. The provider is used to discover and manage clusters. With a provider set to nil, the manager will behave like a regular controller-runtime manager.
func WithMultiCluster ¶
func WithMultiCluster(mgr manager.Manager, provider multicluster.Provider, mcOpts ...Option) (Manager, error)
WithMultiCluster wraps a host manager to run multi-cluster controllers.
Click to show internal directories.
Click to hide internal directories.