controller

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(kubeconfig string) (*rest.Config, error)

func NewConfig

func NewConfig(kubeconfig string) (*rest.Config, error)

func StartControllerManager

func StartControllerManager(controllers ...Controller) <-chan struct{}

StartControllerManager

Types

type Controller

type Controller interface {
	Run(stopCh <-chan struct{})
	GetName() string
}

type DefaultMethods

type DefaultMethods interface {
	Run(stopCh <-chan struct{})
}

func GetDefaults

func GetDefaults(c interface{}) DefaultMethods

type QueueWorker

type QueueWorker struct {
	Queue      workqueue.RateLimitingInterface
	MaxRetries int
	Name       string
	Reconcile  func(key string) error
}

QueueWorker continuously runs a Reconcile function against a message Queue

func (*QueueWorker) ProcessAllMessages

func (q *QueueWorker) ProcessAllMessages()

ProcessAllMessages tries to process all messages in the Queue

func (*QueueWorker) ProcessMessage

func (q *QueueWorker) ProcessMessage() bool

ProcessMessage tries to process the next message in the Queue, and requeues on an error

func (*QueueWorker) Run

func (q *QueueWorker) Run(shutdown <-chan struct{})

Run schedules a routine to continuously process Queue messages until shutdown is closed

type QueueingEventHandler

type QueueingEventHandler struct {
	Queue         workqueue.RateLimitingInterface
	ObjToKey      func(obj interface{}) (string, error)
	EnqueueDelete bool
}

QueueingEventHandler queues the key for the object on add and update events

func (*QueueingEventHandler) OnAdd

func (c *QueueingEventHandler) OnAdd(obj interface{})

func (*QueueingEventHandler) OnDelete

func (c *QueueingEventHandler) OnDelete(obj interface{})

func (*QueueingEventHandler) OnUpdate

func (c *QueueingEventHandler) OnUpdate(oldObj, newObj interface{})

type SharedInformersDefaults

type SharedInformersDefaults struct {
	KubernetesFactory   informers.SharedInformerFactory
	KubernetesClientSet *kubernetes.Clientset

	// Extensions allows a controller-manager to define new data structures
	// shared by all of its controllers.
	// Set this by overriding the InitExtensions function on the generated *SharedInformers
	// type under the consuming projects pkg/controller/sharedinformers package
	// by in a new informers.go file
	Extensions interface{}

	WorkerQueues map[string]*QueueWorker
}

func (*SharedInformersDefaults) Init

func (*SharedInformersDefaults) Init()

Init is called before the informers are started, and can be used to perform any additional initialization shared by multiple controllers

func (*SharedInformersDefaults) InitKubernetesInformers

func (si *SharedInformersDefaults) InitKubernetesInformers(config *rest.Config)

InitKubernetesInformers initializes the Kubernetes clientset and informerfactory informers must still be started by overriding StartAdditionalInformers

func (*SharedInformersDefaults) SetupKubernetesTypes

func (*SharedInformersDefaults) SetupKubernetesTypes() bool

SetupKubernetesTypes can be overridden to initialize the Kubernetes clientset and informers

func (*SharedInformersDefaults) StartAdditionalInformers

func (*SharedInformersDefaults) StartAdditionalInformers(shutdown <-chan struct{})

StartAdditionalInformers is called to start informers for resources not defined in the extension apiserver. Override this and use it to start informers for Kubernetes resources such as Pods

func (*SharedInformersDefaults) Watch

func (c *SharedInformersDefaults) Watch(
	name string, i cache.SharedIndexInformer,
	f func(interface{}) (string, error), r func(string) error)

Jump to

Keyboard shortcuts

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