Back to godoc.org

Package handlers

v0.0.0-...-86f6ded
Latest Go to latest

The latest major version is .

Published: Oct 5, 2019 | License: Apache-2.0 | Module: github.com/atlassian/ctrl

Index

type ControlledResourceHandler

type ControlledResourceHandler struct {
	Logger          *zap.Logger
	WorkQueue       ctrl.WorkQueueProducer
	ControllerIndex ControllerIndex
	ControllerGvk   schema.GroupVersionKind
	Gvk             schema.GroupVersionKind
}

ControlledResourceHandler is a handler for objects the are controlled/owned/produced by some controller object. The controller object is identified by a controller owner reference on the controlled objects. This handler assumes that: - Logger already has the cntrl_gk field set. - controlled and controller objects exist in the same namespace and never across namespaces.

func (*ControlledResourceHandler) OnAdd

func (g *ControlledResourceHandler) OnAdd(obj interface{})

func (*ControlledResourceHandler) OnDelete

func (g *ControlledResourceHandler) OnDelete(obj interface{})

func (*ControlledResourceHandler) OnUpdate

func (g *ControlledResourceHandler) OnUpdate(oldObj, newObj interface{})

type ControllerIndex

type ControllerIndex interface {
	// ControllerByObject returns controller objects that own or want to own an object with a particular Group, Kind,
	// namespace and name. "want to own" means that the object might not exist yet but the controller
	// object would want it to.
	ControllerByObject(gk schema.GroupKind, namespace, name string) ([]runtime.Object, error)
}

ControllerIndex is an index from controlled to controller objects.

type GenericHandler

type GenericHandler struct {
	Logger    *zap.Logger
	WorkQueue ctrl.WorkQueueProducer

	Gvk schema.GroupVersionKind
}

This handler assumes that the Logger already has the obj_gk/ctrl_gk field set.

func (*GenericHandler) OnAdd

func (g *GenericHandler) OnAdd(obj interface{})

func (*GenericHandler) OnDelete

func (g *GenericHandler) OnDelete(obj interface{})

func (*GenericHandler) OnUpdate

func (g *GenericHandler) OnUpdate(oldObj, newObj interface{})

type LookupHandler

type LookupHandler struct {
	Logger    *zap.Logger
	WorkQueue ctrl.WorkQueueProducer
	Gvk       schema.GroupVersionKind

	Lookup func(runtime.Object) ([]runtime.Object, error)
}

LookupHandler is a handler for controlled objects that can be mapped to some controller object through the use of a Lookup function. This handler assumes that the Logger already has the ctrl_gk field set.

func (*LookupHandler) OnAdd

func (e *LookupHandler) OnAdd(obj interface{})

func (*LookupHandler) OnDelete

func (e *LookupHandler) OnDelete(obj interface{})

func (*LookupHandler) OnUpdate

func (e *LookupHandler) OnUpdate(oldObj, newObj interface{})

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier