app

package
v0.0.0-...-215afb5 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControllerStartJitter used when starting controller managers.
	ControllerStartJitter = 1.0
)

Variables

View Source
var ControllersDisabledByDefault = sets.NewString()

ControllersDisabledByDefault configured all controllers that are turned off by default.

Functions

func GetAvailableResources

func GetAvailableResources(clientBuilder clientbuilder.ControllerClientBuilder) (map[schema.GroupVersionResource]bool, error)

func KnownControllers

func KnownControllers() []string

KnownControllers returns the known controllers.

func NewControllerInitializers

func NewControllerInitializers() map[string]InitFunc

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 NewKStoneEtcdOperatorCommand

func NewKStoneEtcdOperatorCommand() *cobra.Command

NewKStoneEtcdOperatorCommand creates a *cobra.Command object with default parameters

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(ctx context.Context, cfg *config.Config) error

Run runs the specified platform controller manager. This should never exit.

func StartControllers

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

StartControllers to start the controller.

Types

type ControllerContext

type ControllerContext struct {
	// KubeClientBuilder will provide a client for this controller to use
	KubeClientBuilder clientbuilder.ControllerClientBuilder

	// KubeInformerFactory gives access to etcd informers for the controller.
	KubeInformerFactory kubeInformer.SharedInformerFactory
	// EtcdInformerFactory gives access to etcd informers for the controller.
	EtcdInformerFactory etcdInformer.SharedInformerFactory
	// TAppInformerFactory gives access to tapp informers for the controller.
	TAppInformerFactory tAppInformer.SharedInformerFactory

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

	// 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
	ControllerStartInterval metav1.Duration

	TAppClient tAppClientSet.Interface
	EtcdClient etcdClientSet.Interface
}

ControllerContext represents the context of controller.

func CreateControllerContext

func CreateControllerContext(ctx context.Context, cfg *config.Config, kubeClientBuilder clientbuilder.ControllerClientBuilder) (ControllerContext, error)

CreateControllerContext creates a context struct containing references to resources needed by the controllers.

func (ControllerContext) IsControllerEnabled

func (c ControllerContext) IsControllerEnabled(name string) bool

IsControllerEnabled returns whether the controller has been enabled

type InitFunc

type InitFunc func(ctx context.Context, controllerCtx ControllerContext) (debuggingHandler http.Handler, enabled bool, err error)

InitFunc is used to launch a particular controller. It may run additional "should I activate checks". Any error returned will cause the controller process to `Fatal` The bool indicates whether the controller was enabled.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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