Documentation ¶
Index ¶
- Constants
- Variables
- func GetAvailableResources(clientBuilder clientbuilder.ControllerClientBuilder) (map[schema.GroupVersionResource]bool, error)
- func KnownControllers() []string
- func NewControllerInitializers() map[string]InitFunc
- func NewGodelControllerCmd() *cobra.Command
- func ResyncPeriod(c *controllerappconfig.CompletedConfig) func() time.Duration
- func Run(ctx context.Context, cc *controllerappconfig.CompletedConfig) error
- func StartControllers(ctx context.Context, controllerCtx ControllerContext, ...) error
- type ControllerContext
- type ControllerInitializersFunc
- type InitFunc
Constants ¶
const ( ComponentName = "godel-controller-manager" // ControllerStartJitter is the Jitter used when starting controller managers ControllerStartJitter = 1.0 ConfigzName = "godel-controller-manager-config" )
Variables ¶
var ControllersDisabledByDefault = sets.NewString()
Functions ¶
func GetAvailableResources ¶
func GetAvailableResources(clientBuilder clientbuilder.ControllerClientBuilder) (map[schema.GroupVersionResource]bool, error)
GetAvailableResources gets the map which contains all available resources of the apiserver TODO: In general, any controller checking this needs to be dynamic so users don't have to restart their controller manager if they change the apiserver. Until we get there, the structure here needs to be exposed for the construction of a proper ControllerContext.
func KnownControllers ¶
func KnownControllers() []string
KnownControllers returns all known controllers' name
func NewControllerInitializers ¶
NewControllerInitializers is a public map of named controller groups (you can start more than one in an init func) paired to their InitFunc. This allows for structured downstream composition and subdivision.
func NewGodelControllerCmd ¶
func ResyncPeriod ¶
func ResyncPeriod(c *controllerappconfig.CompletedConfig) 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(ctx context.Context, cc *controllerappconfig.CompletedConfig) error
func StartControllers ¶
func StartControllers(ctx context.Context, controllerCtx ControllerContext, controllers map[string]InitFunc, unsecuredMux *mux.PathRecorderMux, healthzHandler *controllerhealthz.MutableHealthzHandler, ) error
StartControllers starts a set of controllers with a specified ControllerContext
Types ¶
type ControllerContext ¶
type ControllerContext struct { // ClientBuilder will provide a client for this controller to use ClientBuilder clientbuilder.ControllerClientBuilder GodelClientBuilder clientbuilder.GodelClientBuilder // InformerFactory gives access to informers for the controller. InformerFactory informers.SharedInformerFactory // godel Informer factory GodelInformerFactory crdinformers.SharedInformerFactory // ComponentConfig provides access to init options for a given controller ComponentConfig *godelctrlmgrconfig.GodelControllerManagerConfiguration // 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 // ControllerManagerMetrics provides a proxy to set controller manager specific metrics. ControllerManagerMetrics *controllersmetrics.ControllerManagerMetrics }
ControllerContext defines the context object for controller
func CreateControllerContext ¶
func CreateControllerContext( s *controllerappconfig.CompletedConfig, rootClientBuilder, clientBuilder clientbuilder.ControllerClientBuilder, godelClientBuilder clientbuilder.GodelClientBuilder, stop <-chan struct{}, ) (ControllerContext, error)
CreateControllerContext creates a context struct containing references to resources needed by the controllers such as the cloud provider and clientBuilder. rootClientBuilder is only used for the shared-informers client and token controller.
func (ControllerContext) IsControllerEnabled ¶
func (c ControllerContext) IsControllerEnabled(name string) bool
IsControllerEnabled checks if the context's controllers enabled or not
type ControllerInitializersFunc ¶
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.