app

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: MIT Imports: 57 Imported by: 0

Documentation

Overview

Package app implements a server that runs a set of active components. This includes sync controllers, chains and namespace.

Index

Constants

View Source
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

func ControllerAliases() map[string]string

ControllerAliases returns a mapping of aliases to canonical controller names

func DisabledControllers

func DisabledControllers() []string

func KnownControllers

func KnownControllers() []string

KnownControllers returns all known controllers's name

func NewControllerDescriptors

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

func NewControllerManagerCommand() *cobra.Command

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.

func Run

Run runs the controller manager options. This should never exit.

Types

type AddFunc

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,
) (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

func (c ControllerContext) IsControllerEnabled(controllerDescriptor *ControllerDescriptor) bool

IsControllerEnabled checks if the context's controllers enabled or not

type ControllerDescriptor

type ControllerDescriptor struct {
	// contains filtered or unexported fields
}

func (*ControllerDescriptor) GetAddFunc

func (r *ControllerDescriptor) GetAddFunc() AddFunc

func (*ControllerDescriptor) GetAliases

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

func (r *ControllerDescriptor) GetRequiredFeatureGates() []featuregate.Feature

func (*ControllerDescriptor) IsCloudProviderController

func (r *ControllerDescriptor) IsCloudProviderController() bool

func (*ControllerDescriptor) IsDisabledByDefault

func (r *ControllerDescriptor) IsDisabledByDefault() bool

func (*ControllerDescriptor) Name

func (r *ControllerDescriptor) Name() string

func (*ControllerDescriptor) RequiresSpecialHandling

func (r *ControllerDescriptor) RequiresSpecialHandling() bool

RequiresSpecialHandling should return true only in a special non-generic controllers like ServiceAccountTokenController

Directories

Path Synopsis
Package options provides the flags used for the controller manager.
Package options provides the flags used for the controller manager.

Jump to

Keyboard shortcuts

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