Documentation ¶
Overview ¶
Package app implements a server that runs a set of active components. This includes sync controllers, chains and namespace.
Index ¶
- Constants
- func ControllerAliases() map[string]string
- func DisabledControllers() []string
- func KnownControllers() []string
- func NewControllerDescriptors() map[string]*ControllerDescriptor
- func NewControllerManagerCommand() *cobra.Command
- func ResyncPeriod(c *config.CompletedConfig) func() time.Duration
- func Run(ctx context.Context, c *config.CompletedConfig) error
- type AddFunc
- type ControllerContext
- type ControllerDescriptor
- func (r *ControllerDescriptor) GetAddFunc() AddFunc
- func (r *ControllerDescriptor) GetAliases() []string
- func (r *ControllerDescriptor) GetRequiredFeatureGates() []featuregate.Feature
- func (r *ControllerDescriptor) IsCloudProviderController() bool
- func (r *ControllerDescriptor) IsDisabledByDefault() bool
- func (r *ControllerDescriptor) Name() string
- func (r *ControllerDescriptor) RequiresSpecialHandling() bool
Constants ¶
const ( // ControllerStartJitter is the Jitter used when starting controller managers ControllerStartJitter = 1.0 // ConfigzName is the name used for register onex-controller manager /configz, same with GroupName. ConfigzName = "onexcontrollermanager.config.onex.io" )
Variables ¶
This section is empty.
Functions ¶
func ControllerAliases ¶ added in v0.2.0
ControllerAliases returns a mapping of aliases to canonical controller names
func DisabledControllers ¶ added in v0.2.0
func DisabledControllers() []string
func KnownControllers ¶ added in v0.2.0
func KnownControllers() []string
KnownControllers returns all known controllers's name
func NewControllerDescriptors ¶ added in v0.2.0
func NewControllerDescriptors() map[string]*ControllerDescriptor
NewControllerDescriptors is a public map of named controller groups (you can start more than one in an init func) paired to their ControllerDescriptor wrapper object that includes InitFunc. This allows for structured downstream composition and subdivision.
func NewControllerManagerCommand ¶
NewControllerManagerCommand creates a *cobra.Command object with default parameters.
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.
Types ¶
type AddFunc ¶ added in v0.2.0
type AddFunc func(ctx context.Context, mgr ctrl.Manager, cctx ControllerContext) (enabled bool, err error)
AddFunc 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.
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 // Config provides access to init options for a given controller Config *config.CompletedConfig // DeferredDiscoveryRESTMapper is a RESTMapper that will defer // initialization of the RESTMapper until the first mapping is // requested. RESTMapper *restmapper.DeferredDiscoveryRESTMapper // 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 // GraphBuilder gives an access to dependencyGraphBuilder which keeps tracks of resources in the cluster GraphBuilder *garbagecollector.GraphBuilder // New by OneX MetadataClient metadata.Interface ControllerManagerOptions controller.Options Store store.IStore }
ControllerContext defines the context object for controller
func CreateControllerContext ¶
func CreateControllerContext( ctx context.Context, s *config.CompletedConfig, rootClientBuilder clientbuilder.ControllerClientBuilder, clientBuilder clientbuilder.ControllerClientBuilder, storeClient store.IStore, ) (ControllerContext, error)
CreateControllerContext creates a context struct containing references to resources needed by the controllers such as clientBuilder. rootClientBuilder is only used for the shared-informers client.
func (ControllerContext) IsControllerEnabled ¶ added in v0.2.0
func (c ControllerContext) IsControllerEnabled(controllerDescriptor *ControllerDescriptor) bool
IsControllerEnabled checks if the context's controllers enabled or not
type ControllerDescriptor ¶ added in v0.2.0
type ControllerDescriptor struct {
// contains filtered or unexported fields
}
func (*ControllerDescriptor) GetAddFunc ¶ added in v0.2.0
func (r *ControllerDescriptor) GetAddFunc() AddFunc
func (*ControllerDescriptor) GetAliases ¶ added in v0.2.0
func (r *ControllerDescriptor) GetAliases() []string
GetAliases returns aliases to ensure backwards compatibility and should never be removed! Only addition of new aliases is allowed, and only when a canonical name is changed (please see CHANGE POLICY of controller names)
func (*ControllerDescriptor) GetRequiredFeatureGates ¶ added in v0.2.0
func (r *ControllerDescriptor) GetRequiredFeatureGates() []featuregate.Feature
func (*ControllerDescriptor) IsCloudProviderController ¶ added in v0.2.0
func (r *ControllerDescriptor) IsCloudProviderController() bool
func (*ControllerDescriptor) IsDisabledByDefault ¶ added in v0.2.0
func (r *ControllerDescriptor) IsDisabledByDefault() bool
func (*ControllerDescriptor) Name ¶ added in v0.2.0
func (r *ControllerDescriptor) Name() string
func (*ControllerDescriptor) RequiresSpecialHandling ¶ added in v0.2.0
func (r *ControllerDescriptor) RequiresSpecialHandling() bool
RequiresSpecialHandling should return true only in a special non-generic controllers like ServiceAccountTokenController