bootstrap

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, start StartFunc, opts Options, schemes runtime.SchemeBuilder, localMode bool) error

Start a controller with the given start func. The StartFunc will be called with a bootstrapped local manager. If localMode is false, the StartParameters will include initialized multicluster components.

func StartMulti

func StartMulti(
	ctx context.Context,
	startFuncs map[string]StartFunc,
	opts Options,
	schemes runtime.SchemeBuilder,
	localMode bool,
	addStatsHandlers ...func(mux *http.ServeMux, profiles map[string]string),
) error

Like Start, but runs multiple StartFuncs concurrently

Types

type Options

type Options struct {
	// MetricsBindPort is the TCP port that the controller should bind to
	// for serving prometheus metrics.
	// It can be set to 0 to disable the metrics serving.
	MetricsBindPort uint32

	// MasterNamespace if specified restricts the Master manager's cache to watch objects in the desired namespace.
	// Defaults to all namespaces.
	//
	// Note: If a namespace is specified, controllers can still Watch for a cluster-scoped resource (e.g Node).  For namespaced resources the cache will only hold objects from the desired namespace.
	MasterNamespace string

	// enables verbose mode
	VerboseMode bool

	// enables dev logger (instead of prod logger)
	// NOTE: DO NOT set this to true in Prod, it will crash on DPanic
	DevLogger bool

	// ManagementContext if specified read the KubeConfig for the management cluster from this context. Only applies when running out of cluster.
	ManagementContext string

	// Reference to the Settings object that the controller should use.
	SettingsRef v1.ObjectRef
}

bootstrap options for starting discovery

func (*Options) AddToFlags

func (opts *Options) AddToFlags(flags *pflag.FlagSet)

convenience function for setting these options via spf13 flags

type StartFunc

type StartFunc func(
	ctx context.Context,
	parameters StartParameters,
) error

the start function that will be called with the initialized parameters

type StartParameters

type StartParameters struct {
	MasterManager   manager.Manager
	McClient        multicluster.Client    // nil if running in agent mode
	Clusters        multicluster.Interface // nil if running in agent mode
	SnapshotHistory stats.SnapshotHistory
	// Reference to Settings object this controller uses.
	SettingsRef v1.ObjectRef
	// enable additional logging
	VerboseMode bool
}

StartParameters specify paramters for starting a generic controller which may need access to its local cluster as well as remote (multicluster) clients and managers

Jump to

Keyboard shortcuts

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