app

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 45 Imported by: 70

Documentation

Overview

Package app implements a server that runs a set of active components. This includes node controllers, service and route controller, and so on.

Index

Constants

View Source
const (
	// ControllerStartJitter is the jitter value used when starting controller managers.
	ControllerStartJitter = 1.0
	// ConfigzName is the name used for register cloud-controller manager /configz, same with GroupName.
	ConfigzName = "cloudcontrollermanager.config.k8s.io"
)

Variables

View Source
var ControllersDisabledByDefault = sets.NewString()

ControllersDisabledByDefault is the controller disabled default when starting cloud-controller managers.

View Source
var DefaultInitFuncConstructors = map[string]ControllerInitFuncConstructor{

	"cloud-node": {
		InitContext: ControllerInitContext{
			ClientName: "node-controller",
		},
		Constructor: StartCloudNodeControllerWrapper,
	},
	"cloud-node-lifecycle": {
		InitContext: ControllerInitContext{
			ClientName: "node-controller",
		},
		Constructor: StartCloudNodeLifecycleControllerWrapper,
	},
	"service": {
		InitContext: ControllerInitContext{
			ClientName: "service-controller",
		},
		Constructor: StartServiceControllerWrapper,
	},
	"route": {
		InitContext: ControllerInitContext{
			ClientName: "route-controller",
		},
		Constructor: StartRouteControllerWrapper,
	},
}

DefaultInitFuncConstructors is a map of default named controller groups paired with InitFuncConstructor

Functions

func ConstructControllerInitializers added in v0.20.6

func ConstructControllerInitializers(controllerInitFuncConstructors map[string]ControllerInitFuncConstructor, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) map[string]InitFunc

ConstructControllerInitializers is a map of controller name(as defined by controllers flag in https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/#options) to their InitFuncConstructor. paired to their InitFunc. This allows for structured downstream composition and subdivision.

func ControllerNames added in v0.20.6

func ControllerNames(controllerInitFuncConstructors map[string]ControllerInitFuncConstructor) []string

ControllerNames indicate the default controller we are known.

func CreateControllerContext

func CreateControllerContext(s *cloudcontrollerconfig.CompletedConfig, clientBuilder clientbuilder.ControllerClientBuilder, stop <-chan struct{}) (genericcontrollermanager.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 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 NewCloudControllerManagerCommand

func NewCloudControllerManagerCommand(s *options.CloudControllerManagerOptions, cloudInitializer InitCloudFunc, controllerInitFuncConstructors map[string]ControllerInitFuncConstructor, additionalFlags cliflag.NamedFlagSets, stopCh <-chan struct{}) *cobra.Command

NewCloudControllerManagerCommand creates a *cobra.Command object with default parameters controllerInitFuncConstructors is a map of controller name(as defined by controllers flag in https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/#options) to their InitFuncConstructor. additionalFlags provides controller specific flags to be included in the complete set of controller manager flags

func ResyncPeriod

func ResyncPeriod(c *cloudcontrollerconfig.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 *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface, controllerInitializers map[string]InitFunc, stopCh <-chan struct{}) error

Run runs the ExternalCMServer. This should never exit.

Types

type ControllerInitContext added in v0.23.0

type ControllerInitContext struct {
	ClientName string
}

type ControllerInitFuncConstructor added in v0.23.0

type ControllerInitFuncConstructor struct {
	InitContext ControllerInitContext
	Constructor InitFuncConstructor
}

type InitCloudFunc added in v0.20.6

InitCloudFunc is used to initialize cloud

type InitFunc

type InitFunc func(ctx context.Context, controllerContext genericcontrollermanager.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.

func StartCloudNodeControllerWrapper

func StartCloudNodeControllerWrapper(initContext ControllerInitContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) InitFunc

StartCloudNodeControllerWrapper is used to take cloud config as input and start cloud node controller

func StartCloudNodeLifecycleControllerWrapper added in v0.23.0

func StartCloudNodeLifecycleControllerWrapper(initContext ControllerInitContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) InitFunc

StartCloudNodeLifecycleControllerWrapper is used to take cloud config as input and start cloud node lifecycle controller

func StartRouteControllerWrapper added in v0.23.0

func StartRouteControllerWrapper(initContext ControllerInitContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) InitFunc

StartRouteControllerWrapper is used to take cloud config as input and start route controller

func StartServiceControllerWrapper added in v0.23.0

func StartServiceControllerWrapper(initContext ControllerInitContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) InitFunc

StartServiceControllerWrapper is used to take cloud config as input and start service controller

type InitFuncConstructor added in v0.20.6

type InitFuncConstructor func(initcontext ControllerInitContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) InitFunc

InitFuncConstructor is used to construct InitFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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