app

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: AGPL-3.0 Imports: 102 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-only Provenance-includes-location: https://github.com/kubernetes/kubernetes/blob/v1.31.3/cmd/kube-controller-manager/app/controllermanager.go Provenance-includes-license: Apache-2.0 Provenance-includes-copyright: The Kubernetes Authors.

SPDX-License-Identifier: AGPL-3.0-only

Index

Constants

View Source
const (
	// ControllerStartJitter is the Jitter used when starting controller managers
	ControllerStartJitter = 1.0
	// ConfigzName is the name used for registering datum-controller-manager /configz.
	ConfigzName = "datumcontrollermanager.config.k8s.io"
)

Variables

View Source
var (
	// Scheme is the runtime Scheme to which all API types are registered.
	Scheme = runtime.NewScheme()

	// SystemNamespace is the namespace to use for system components and resources
	// that are automatically created to run the system.
	SystemNamespace string

	// OrganizationOwnerRoleName is the name of the role that will be used to grant organization owner permissions.
	OrganizationOwnerRoleName string

	// OrganizationOwnerRoleNamespace is the namespace where the organization owner role is located.
	// This allows service providers to configure where owner roles are stored.
	OrganizationOwnerRoleNamespace string

	// ProjectOwnerRoleName is the name of the role that will be used to grant project owner permissions.
	ProjectOwnerRoleName string

	// ProjectOwnerRoleNamespace is the namespace where the project owner role is located.
	// This allows service providers to configure where owner roles are stored.
	ProjectOwnerRoleNamespace string

	// GetInvitationRoleName is the name of the role that will be used to grant get invitation permissions.
	GetInvitationRoleName string

	// AcceptInvitationRoleName is the name of the role that will be used to grant accept invitation permissions.
	AcceptInvitationRoleName string

	// UserInvitationEmailTemplate is the template for the user invitation email.
	UserInvitationEmailTemplate string

	// UserWaitlistPendingEmailTemplate is the template for the waitlist pending email.
	UserWaitlistPendingEmailTemplate string
	// UserWaitlistApprovedEmailTemplate is the template for the waitlist approved email.
	UserWaitlistApprovedEmailTemplate string
	// UserWaitlistRejectedEmailTemplate is the template for the waitlist rejected email.
	UserWaitlistRejectedEmailTemplate string
	// PlatformInvitationEmailTemplate is the template for the platform invitation email.
	PlatformInvitationEmailTemplate string

	// WaitlistRelatedResourcesNamespace is the namespace that contains the waitlist related resources.
	WaitlistRelatedResourcesNamespace string

	// PlatformInvitationActionUrl is the action url for the platform invitation email.
	PlatformInvitationEmailVariableActionUrl string

	// AssignableRolesNamespace is an extra namespace that the system allows to be used for assignable roles.
	AssignableRolesNamespace string

	// OrganizationMembershipSelfDeleteRoleName is the name of the role that will be used to grant organization membership self delete permissions.
	OrganizationMembershipSelfDeleteRoleName string

	// OrganizationMembershipSelfDeleteRoleNamespace is the namespace where the organization membership self delete role is located.
	// This allows service providers to configure where self delete roles are stored.
	OrganizationMembershipSelfDeleteRoleNamespace string

	// NoteCreatorEditorRoleName is the name of the role that will be used to grant note creator edit permissions.
	NoteCreatorEditorRoleName string

	// UserContactNamespace is the namespace where user contacts will be created/managed.
	// When a User is created, the UserContactController will create or update Contacts in this namespace.
	UserContactNamespace string
)

Functions

func ControllerAliases

func ControllerAliases() map[string]string

ControllerAliases returns a mapping of aliases to canonical controller names

func ControllersDisabledByDefault

func ControllersDisabledByDefault() []string

func KnownControllers

func KnownControllers() []string

KnownControllers returns all known controllers's name

func NewCommand

func NewCommand() *cobra.Command

NewCommand creates a *cobra.Command object with default parameters

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

func Run(ctx context.Context, c *config.CompletedConfig, opts *Options) error

Run runs the KubeControllerManagerOptions.

func StartController

func StartController(ctx context.Context, controllerCtx ControllerContext, controllerDescriptor *ControllerDescriptor,
	unsecuredMux *mux.PathRecorderMux) (healthz.HealthChecker, error)

StartController starts a controller with a specified ControllerContext and performs required pre- and post- checks/actions

func StartControllers

func StartControllers(ctx context.Context, controllerCtx ControllerContext, controllerDescriptors map[string]*ControllerDescriptor,
	unsecuredMux *mux.PathRecorderMux, healthzHandler *controllerhealthz.MutableHealthzHandler) error

StartControllers starts a set of controllers with a specified ControllerContext

Types

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

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

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

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

func (r *ControllerDescriptor) GetInitFunc() InitFunc

func (*ControllerDescriptor) GetRequiredFeatureGates

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

func (*ControllerDescriptor) IsDisabledByDefault

func (r *ControllerDescriptor) IsDisabledByDefault() bool

func (*ControllerDescriptor) Name

func (r *ControllerDescriptor) Name() string

type ControllerLoopMode

type ControllerLoopMode int

ControllerLoopMode is the datum-controller-manager's mode of running controller loops that are cloud provider dependent

const (
	// IncludeCloudLoops means the datum-controller-manager include the controller loops that are cloud provider dependent
	IncludeCloudLoops ControllerLoopMode = iota
	// ExternalLoops means the datum-controller-manager exclude the controller loops that are cloud provider dependent
	ExternalLoops
)

type InitFunc

type InitFunc func(ctx context.Context, controllerContext ControllerContext, controllerName string) (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.

type Options

type Options struct {
	*options.KubeControllerManagerOptions

	InfraCluster *infracluster.Options
	ControlPlane *controlplane.Options

	// The port to use for the controller-runtime webhook server.
	ControllerRuntimeWebhookPort int
}

Options defines the configuration options available for modifying the behavior of the controller manager.

func NewOptions

func NewOptions() (*Options, error)

NewOptions creates a new Options object with default values.

Jump to

Keyboard shortcuts

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