app

package
v1.35.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 166 Imported by: 536

Documentation

Overview

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

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

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Package app implements a server that runs a set of active components. This includes replication controllers, service endpoints and nodes.

Index

Constants

View Source
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 AttemptToLoadRecycler added in v1.2.0

func AttemptToLoadRecycler(path string, config *volume.VolumeConfig) error

AttemptToLoadRecycler tries decoding a pod from a filepath for use as a recycler for a volume. If successful, this method will set the recycler on the config. If unsuccessful, an error is returned. Function is exported for reuse downstream.

func ControllerAliases added in v1.29.0

func ControllerAliases() map[string]string

ControllerAliases returns a mapping of aliases to canonical controller names

func ControllersDisabledByDefault added in v1.6.0

func ControllersDisabledByDefault() []string

func GetDynamicPluginProber added in v1.8.0

GetDynamicPluginProber gets the probers of dynamically discoverable plugins for the attach/detach controller. Currently only Flexvolume plugins are dynamically discoverable.

func KnownControllers added in v1.6.0

func KnownControllers() []string

KnownControllers returns all known controllers' name

func NewControllerDescriptors added in v1.29.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 the associated controller constructor. This allows for structured downstream composition and subdivision.

func NewControllerManagerCommand added in v1.1.1

func NewControllerManagerCommand() *cobra.Command

NewControllerManagerCommand creates a *cobra.Command object with default parameters

func ProbeAttachableVolumePlugins added in v1.3.0

func ProbeAttachableVolumePlugins(logger klog.Logger, config persistentvolumeconfig.VolumeConfiguration) ([]volume.VolumePlugin, error)

ProbeAttachableVolumePlugins collects all volume plugins for the attach/ detach controller.

func ProbeExpandableVolumePlugins added in v1.8.0

func ProbeExpandableVolumePlugins(logger klog.Logger, config persistentvolumeconfig.VolumeConfiguration) ([]volume.VolumePlugin, error)

ProbeExpandableVolumePlugins returns volume plugins which are expandable

func ProbePersistentVolumePlugins added in v1.32.0

func ProbePersistentVolumePlugins(logger klog.Logger, config persistentvolumeconfig.VolumeConfiguration) ([]volume.VolumePlugin, error)

ProbePersistentVolumePlugins collects all volume plugins that are actually persistent.

func ProbeProvisionableRecyclableVolumePlugins added in v1.32.0

func ProbeProvisionableRecyclableVolumePlugins(logger klog.Logger, config persistentvolumeconfig.VolumeConfiguration) ([]volume.VolumePlugin, error)

func ResyncPeriod added in v1.2.0

func ResyncPeriod(c *config.CompletedConfig) func() time.Duration

ResyncPeriod returns a function which generates a duration each time it is invoked; this is because that multiple controllers don't get into lock-step.

func Run added in v1.2.0

Run runs the KubeControllerManagerOptions.

func RunControllers

func RunControllers(ctx context.Context, controllerCtx ControllerContext, controllers []Controller,
	controllerStartJitterMaxFactor float64, shutdownTimeout time.Duration) bool

RunControllers runs all controllers concurrently and blocks until the context is cancelled and all controllers are terminated.

Once the context is cancelled, RunControllers waits for shutdownTimeout for all controllers to terminate. When the timeout is reached, the function unblocks and returns false. Zero shutdown timeout means that there is no timeout.

Types

type Controller

type Controller interface {
	// Name returns the controller's canonical name.
	Name() string

	// Run runs the controller loop.
	// When there is anything to be done, it blocks until the context is cancelled.
	// Run must ensure all goroutines are terminated before returning.
	Run(context.Context)
}

Controller defines the base interface that all controller wrappers must implement.

func BuildControllers

func BuildControllers(ctx context.Context, controllerCtx ControllerContext, controllerDescriptors map[string]*ControllerDescriptor,
	unsecuredMux *mux.PathRecorderMux, healthzHandler HealthCheckAdder) ([]Controller, error)

BuildControllers builds all controllers in the given descriptor map. Disabled controllers are obviously skipped.

A health check is registered for each controller using the controller name. The default check always passes. If the controller implements controller.HealthCheckable, though, the given check is used. The controller can also implement controller.Debuggable, in which case the debug handler is registered with the given mux.

type ControllerConstructor

type ControllerConstructor func(ctx context.Context, controllerContext ControllerContext, controllerName string) (Controller, error)

ControllerConstructor is a constructor for a controller. A nil Controller returned means that the associated controller is disabled.

type ControllerContext added in v1.6.0

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

	// 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
}

ControllerContext defines the context object for controller

func CreateControllerContext added in v1.7.0

func CreateControllerContext(ctx context.Context, s *config.CompletedConfig, rootClientBuilder, clientBuilder clientbuilder.ControllerClientBuilder) (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 (ControllerContext) IsControllerEnabled added in v1.6.0

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

IsControllerEnabled checks if the context's controllers enabled or not

func (ControllerContext) NewClient

func (c ControllerContext) NewClient(name string) (kubernetes.Interface, error)

NewClient is a shortcut for ClientBuilder.Client. It wraps the error with an additional message.

func (ControllerContext) NewClientConfig

func (c ControllerContext) NewClientConfig(name string) (*restclient.Config, error)

NewClientConfig is a shortcut for ClientBuilder.Config. It wraps the error with an additional message.

type ControllerDescriptor added in v1.29.0

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

func (*ControllerDescriptor) BuildController

func (r *ControllerDescriptor) BuildController(ctx context.Context, controllerCtx ControllerContext) (Controller, error)

BuildController creates a controller based on the given descriptor. The associated controller's constructor is called at the end, so the same contract applies for the return values here.

func (*ControllerDescriptor) GetAliases added in v1.29.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) GetControllerConstructor

func (r *ControllerDescriptor) GetControllerConstructor() ControllerConstructor

func (*ControllerDescriptor) GetRequiredFeatureGates added in v1.29.0

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

func (*ControllerDescriptor) IsCloudProviderController added in v1.29.0

func (r *ControllerDescriptor) IsCloudProviderController() bool

func (*ControllerDescriptor) IsDisabledByDefault added in v1.29.0

func (r *ControllerDescriptor) IsDisabledByDefault() bool

func (*ControllerDescriptor) Name added in v1.29.0

func (r *ControllerDescriptor) Name() string

func (*ControllerDescriptor) RequiresSpecialHandling added in v1.29.0

func (r *ControllerDescriptor) RequiresSpecialHandling() bool

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

type HealthCheckAdder

type HealthCheckAdder interface {
	AddHealthChecker(checks ...healthz.HealthChecker)
}

HealthCheckAdder is an interface to represent a healthz handler. The extra level of indirection is useful for testing.

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