Documentation ¶
Overview ¶
Package app imports the API groups that the client will support TODO: Remove this file when namespace controller and garbage collector stops using legacyscheme.Registry.RESTMapper()
Index ¶
- Constants
- func ContextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc)
- func GetAvailableResources(clientBuilder clientbuilder.ControllerClientBuilder) (map[schema.GroupVersionResource]bool, error)
- func NewControllerInitializers() map[string]InitFunc
- func ResyncPeriod(c *config.CompletedConfig) func() time.Duration
- func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error
- func RunKubeControllers(cfg *restclient.Config, clientCert, clientKey string) error
- func StartControllers(ctx context.Context, controllerCtx ControllerContext, ...) error
- type ControllerContext
- type ControllerInitializersFunc
- type ControllerLoopMode
- type InitFunc
Constants ¶
const ( // ControllerStartJitter is the Jitter used when starting controller managers ControllerStartJitter = 1.0 // ConfigzName is the name used for register kube-controller manager /configz, same with GroupName. ConfigzName = "kubecontrollermanager.config.k8s.io" )
Variables ¶
This section is empty.
Functions ¶
func ContextForChannel ¶
func ContextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc)
ContextForChannel a copy of "k8s.io/apimachinery/pkg/util/wait".contextForChannel
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 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 ResyncPeriod ¶
func ResyncPeriod(c *config.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(c *config.CompletedConfig, stopCh <-chan struct{}) error
Run runs the KubeControllerManagerOptions.
func RunKubeControllers ¶
func RunKubeControllers(cfg *restclient.Config, clientCert, clientKey string) 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 // InformerFactory gives access to informers for the controller. InformerFactory informers.SharedInformerFactory // ObjectOrMetadataInformerFactory gives access to informers for typed resources // and dynamic resources by their metadata. All generic controllers currently use // object metadata - if a future controller needs access to the full object this // would become GenericInformerFactory and take a dynamic client. ObjectOrMetadataInformerFactory informerfactory.InformerFactory // ComponentConfig provides access to init options for a given controller ComponentConfig kubectrlmgrconfig.KubeControllerManagerConfiguration // DeferredDiscoveryRESTMapper is a RESTMapper that will defer // initialization of the RESTMapper until the first mapping is // requested. RESTMapper *restmapper.DeferredDiscoveryRESTMapper // 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(s *config.CompletedConfig, rootClientBuilder, clientBuilder clientbuilder.ControllerClientBuilder, 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.
type ControllerInitializersFunc ¶
ControllerInitializersFunc is used to create a collection of initializers
given the loopMode.
type ControllerLoopMode ¶
type ControllerLoopMode int
ControllerLoopMode is the kube-controller-manager's mode of running controller loops that are cloud provider dependent
const ( // IncludeCloudLoops means the kube-controller-manager include the controller loops that are cloud provider dependent IncludeCloudLoops ControllerLoopMode = iota // ExternalLoops means the kube-controller-manager exclude the controller loops that are cloud provider dependent ExternalLoops )
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.