controller

package
v0.0.0-...-432d548 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControllerManagerUserAgent is the userAgent name when starting controller managers.
	ControllerManagerUserAgent = "c2-scheduler"
	// AllNamespace express all name space
	AllNamespace = "all-namespaces"
	// EmptyNamespace express not set namespace
	EmptyNamespace = ""

	// MemKubeCheckerName MemKubeCheckerName
	MemKubeCheckerName = "memkube-config-checker"
)
View Source
const (
	//MemkubeRegisterPrefix memkube service node register prefix
	MemkubeRegisterPrefix = "memkube:register:v1"
)

Variables

This section is empty.

Functions

func CreateLocalClient

func CreateLocalClient(s *config.Config, stopCh <-chan struct{}, silentWatch bool) (*memclient.LocalClient, error)

CreateLocalClient create a mem-kube local client.

func InitFlags

func InitFlags(flagset *pflag.FlagSet)

InitFlags is for explicitly initializing the flags.

func NewControllerManagerCommand

func NewControllerManagerCommand(controllers map[string]InitFunc) *cobra.Command

NewControllerManagerCommand creates a *cobra.Command object with default parameters

Types

type ClientBuilder

type ClientBuilder interface {
	Client(name string) (clientset.Interface, error)
	ClientOrDie(name string) clientset.Interface
	CarbonClient(name string) (carbonclientset.Interface, error)
	CarbonClientOrDie(name string) carbonclientset.Interface
	DynamicClient(name string) (dynamic.Interface, error)
	DynamicClientOrDie(name string) dynamic.Interface
}

ClientBuilder allows you to get clients and configs for controllers

type Context

type Context struct {
	// ClientBuilder will provide a client for this controller to use
	ClientBuilder ClientBuilder

	KubeClient    clientset.Interface
	CarbonClient  carbonclientset.Interface
	DynamicClient dynamic.Interface
	// InformerFactory gives access to informers for the controller.
	InformerFactory       informers.SharedInformerFactory
	ConfigInformerFactory informers.SharedInformerFactory
	SystemInformerFactory informers.SharedInformerFactory

	// CarbonInformerFactory gives access to carbon informers for the controller.
	CarbonInformerFactory carboninformers.SharedInformerFactory

	// Stop is the stop channel
	Stop   <-chan struct{}
	Waiter *sync.WaitGroup
	// 某些controller需要等到manager完全运行起来之后才能开始,InformersStarted 作为通知通道
	// 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{}

	// DeferredDiscoveryRESTMapper is a RESTMapper that will defer
	// initialization of the RESTMapper until the first mapping is
	// requested.
	RESTMapper *restmapper.DeferredDiscoveryRESTMapper

	Controllers []string
	// LabelSelector and Namespace defines the scope of the controller
	LabelSelector string
	Namespace     string
	Cluster       string

	ConcurrentSyncs int32

	//ExtendConfig define the external config file path for controllers
	ExtendConfig string

	// delay duration before controllers start after became to leader
	DelayStart metav1.Duration

	LocalClient *memclient.LocalClient

	WriteLabels map[string]string
	// contains filtered or unexported fields
}

Context define the context of controller

type InitFunc

type InitFunc func(ctx Context) (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.

type SimpleControllerClientBuilder

type SimpleControllerClientBuilder struct {
	ClientConfig *restclient.Config
	// contains filtered or unexported fields
}

SimpleControllerClientBuilder returns a fixed client with different user agents

func (SimpleControllerClientBuilder) CarbonClient

CarbonClient build a client or die

func (SimpleControllerClientBuilder) CarbonClientOrDie

CarbonClientOrDie build a client or die

func (SimpleControllerClientBuilder) Client

Client build a client

func (SimpleControllerClientBuilder) ClientOrDie

ClientOrDie build a client or die

func (SimpleControllerClientBuilder) Config

Config set the config

func (SimpleControllerClientBuilder) ConfigOrDie

ConfigOrDie set the config or die

func (SimpleControllerClientBuilder) DynamicClient

func (b SimpleControllerClientBuilder) DynamicClient(name string) (dynamic.Interface, error)

DynamicClient build a dynamic client

func (SimpleControllerClientBuilder) DynamicClientOrDie

func (b SimpleControllerClientBuilder) DynamicClientOrDie(name string) dynamic.Interface

DynamicClientOrDie build a dynamic client or die

Jump to

Keyboard shortcuts

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