app

package
v0.0.0-...-a134451 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControllerStartJitter is the Jitter used when starting controller managers
	ControllerStartJitter = 1.0
)

Variables

View Source
var ControllersDisabledByDefault = sets.NewString()

ControllersDisabledByDefault is the set of controllers which is disabled by default

Functions

func IsControllerEnabled

func IsControllerEnabled(name string, disabledByDefaultControllers sets.String, controllers []string) bool

IsControllerEnabled check if a specified controller enabled or not.

func NewControllerInitializers

func NewControllerInitializers() map[string]InitFunc

func NewControllerManagerCommand

func NewControllerManagerCommand() *cli.App

func ResyncPeriod

func ResyncPeriod(c *config.Config) func() time.Duration

ResyncPeriod returns a function which generates a duration each time it is invoked; this is so that multiple controllers don't get into lock-step and all hammer the apiserver with list requests simultaneously.

func Run

func Run(c *config.Config, stopCh <-chan struct{}) error

func StartControllers

func StartControllers(ctx context.Context, controllerCtx ControllerContext, controllers map[string]InitFunc) error

Types

type ControllerContext

type ControllerContext struct {

	// InformerFactory gives access to informers for the controller.
	InformerFactory informers.SharedInformerFactory

	// ComponentConfig provides access to init options for a given controller
	ComponentConfig *config.Config

	// AvailableResources is a map listing currently available resources
	AvailableResources map[schema.GroupVersionResource]bool

	// InformersStarted is closed after all of the controllers have been initialized and are running.  After this point it is safe,
	// for an individual controller to start the shared informers. Before it is closed, they should not.
	InformersStarted chan struct{}

	// ResyncPeriod generates a duration each time it is invoked; this is so that
	// multiple controllers don't get into lock-step and all hammer the apiserver
	// with list requests simultaneously.
	ResyncPeriod func() time.Duration
}

ControllerContext defines the context object for controller

func CreateControllerContext

func CreateControllerContext(c *config.Config, _ <-chan struct{}) (ControllerContext, error)

func (ControllerContext) IsControllerEnabled

func (c ControllerContext) IsControllerEnabled(name string) bool

type ControllerInitializersFunc

type ControllerInitializersFunc func() (initializers map[string]InitFunc)

ControllerInitializersFunc is used to create a collection of initializers

given the loopMode.

type InitFunc

type InitFunc func(ctx context.Context, controllerCtx ControllerContext) (controller controller.Interface, enabled bool, err error)

InitFunc is used to launch a particular controller. It returns a controller that can optionally implement other interfaces so that the controller manager can support the requested features. The returned controller may be nil, which will be considered an anonymous controller that requests no additional features from the controller manager. Any error returned will cause the controller process to `Fatal` The bool indicates whether the controller was enabled.

Jump to

Keyboard shortcuts

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