controllers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 15 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Known

func Known() map[string]Constructor

Known returns a map of the registered controller Constructors

func PodControlledByCluster

func PodControlledByCluster(
	cluster metav1.Object,
	pod *apiv1.Pod,
	ssLister appslisters.StatefulSetLister,
) (bool, error)

func Register

func Register(name string, fn Constructor)

Register registers a controller constructor with the controller package

Types

type Action

type Action interface {
	Name() string
	// Execute should attempt to execute the action. If it is not possible to
	// apply the specified changes (e.g. due to the cluster not being in a
	// 'ready state', or some transient error) then an error will be returned
	// so the action can be requeued. This allows for non-blocking blocking of
	// actions, with retries. The workqueues default scheduling and rate limit
	// will thus handle fairness within Navigator, and handle backing off on
	// retries.
	Execute(state *State) error
}

type BlockingEventHandler

type BlockingEventHandler struct {
	WorkFunc func(obj interface{})
}

BlockingEventHandler is an implementation of cache.ResourceEventHandler that simply synchronously calls it's WorkFunc upon calls to OnAdd, OnUpdate or OnDelete.

func (*BlockingEventHandler) Enqueue

func (b *BlockingEventHandler) Enqueue(obj interface{})

func (*BlockingEventHandler) OnAdd

func (b *BlockingEventHandler) OnAdd(obj interface{})

func (*BlockingEventHandler) OnDelete

func (b *BlockingEventHandler) OnDelete(obj interface{})

func (*BlockingEventHandler) OnUpdate

func (b *BlockingEventHandler) OnUpdate(old, new interface{})

type Constructor

type Constructor func(ctx *Context) Interface

Constructor is a function that creates a new control loop given a controller Context.

type Context

type Context struct {
	Client          kubernetes.Interface
	NavigatorClient clientset.Interface

	// Recorder to record events to
	Recorder                  record.EventRecorder
	KubeSharedInformerFactory kubeinformers.SharedInformerFactory
	SharedInformerFactory     intinformers.SharedInformerFactory

	Namespace string
}

type Interface

type Interface func(workers int, stopCh <-chan struct{}) error

Interface represents a controller that can run. 'workers' should be the number of independent goroutines for this controller in question that are to be run, and the workers should shut down upon a signal on stopCh. This method should block until all workers have exited cleanly, thus allowing for graceful shutdown of control loops.

type QueuingEventHandler

type QueuingEventHandler struct {
	Queue workqueue.RateLimitingInterface
}

QueuingEventHandler is an implementation of cache.ResourceEventHandler that simply queues objects that are added/updated/deleted.

func (*QueuingEventHandler) Enqueue

func (q *QueuingEventHandler) Enqueue(obj interface{})

func (*QueuingEventHandler) OnAdd

func (q *QueuingEventHandler) OnAdd(obj interface{})

func (*QueuingEventHandler) OnDelete

func (q *QueuingEventHandler) OnDelete(obj interface{})

func (*QueuingEventHandler) OnUpdate

func (q *QueuingEventHandler) OnUpdate(old, new interface{})

type State

type State struct {
	// The Clientset to use when performing updates
	Clientset kubernetes.Interface
	// The NavigatorClientset to use for updates
	NavigatorClientset clientset.Interface
	Recorder           record.EventRecorder

	StatefulSetLister    appslisters.StatefulSetLister
	ConfigMapLister      corelisters.ConfigMapLister
	PilotLister          listers.PilotLister
	PodLister            corelisters.PodLister
	ServiceLister        corelisters.ServiceLister
	ServiceAccountLister corelisters.ServiceAccountLister
	RoleBindingLister    rbaclisters.RoleBindingLister
	RoleLister           rbaclisters.RoleLister
}

State contains the current state of the world, including accessors for modifying this state (e.g. kubernetes clientsets)

Jump to

Keyboard shortcuts

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