controller

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLockingCallbackHandler

func NewLockingCallbackHandler(callback func(v1.Resource)) cache.ResourceEventHandler

Returns a handler that runs the given function every time an update occurs, passing in the updated resource. Ensures that only one callback can run at a time.

func NewLockingSyncHandler

func NewLockingSyncHandler(f func()) cache.ResourceEventHandler

returns a handler that runs f() every time an update occurs, regardless of which type of update ensures only one f() can run at a time

func NewSyncHandler

func NewSyncHandler(f func()) cache.ResourceEventHandler

returns a handler that runs f() every time an update occurs, regardless of which type of update

Types

type Controller

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

This custom Kubernetes controller is used to provide a shared caching mechanism for the solo-kit resource clients.

func NewController

func NewController(
	controllerName string,
	handler cache.ResourceEventHandler,
	informers ...cache.SharedIndexInformer) *Controller

Returns a new kubernetes controller without starting it.

func (*Controller) Run

func (c *Controller) Run(parallelism int, stopCh <-chan struct{}) error

Starts the controller by:

1. Registering the event handler with each if the informers 2. Starting each informer 3. Wait for the informer caches to sync 4. Starting a number of parallel workers equal to the "parallelism" parameter

When stopCh is closed, the controller will stop the informers, shutdown the work queue and wait for workers to finish processing their current work items.

Jump to

Keyboard shortcuts

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