trigger

package
v3.7.0-0.174.0+incompa... Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnresolvedTag = fmt.Errorf("one or more triggers on this object cannot be resolved")

ErrUnresolvedTag is used to indicate a resource is not ready to be triggered

Functions

func NewTagRetriever

NewTagRetriever will return a tag retriever that can look up image stream tag references from an image stream.

func NewTriggerCache

func NewTriggerCache() cache.ThreadSafeStore

NewTriggerCache constructs a cacher that expects objects of type *trigger.CacheEntry and converts those triggers into entries in the thread safe cache by image stream namespace and name.

func NewTriggerEventBroadcaster

func NewTriggerEventBroadcaster(client kv1core.CoreV1Interface) record.EventBroadcaster

func ProcessEvents

ProcessEvents returns a ResourceEventHandler suitable for use with an Informer to maintain the cache. indexer is responsible for calculating triggers and any pending changes. Operations are added to the operation queue if a change is required.

Types

type TriggerController

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

TriggerController updates fields on resources to the docker image reference that an ImageStreamTag points to. Different resource types may have different mechanisms for describing triggers (DeploymentConfigs and BuildConfigs have fields, other resource types use annotations) and different mechanisms for updating the objects. The provided TriggerSources map objects into a set of triggers (trigger.CacheEntry) watches for either object changes or image stream tag changes, and then calls a type specific ImageReactor function with the latest cached copy of the object. Because image triggers are explicitly level driven, the controller avoids pre- calculating the state of images, preferring to let the image reaction itself retrieve the latest tag. The controller will try forever to apply image changes but a backoff will be used.

Trigger indexers must handle logical failures themselves (for types that don't do validation up front), and ImageReactors are responsible for applying type specific business logic (DeploymentConfigs do not fire for the first time until all potential images have resolved at least once).

func NewTriggerController

func NewTriggerController(eventBroadcaster record.EventBroadcaster, isInformer imageinformer.ImageStreamInformer, sources ...TriggerSource) *TriggerController

NewTriggerController instantiates a trigger controller from the provided sources.

func (*TriggerController) Run

func (c *TriggerController) Run(workers int, stopCh <-chan struct{})

Run begins watching and syncing.

type TriggerSource

type TriggerSource struct {
	// Resource is a value guaranteed to be unique across all TriggerSources passed
	// to a given controller - used to separate keys processed by this controller.
	Resource schema.GroupResource
	// Informer is the source of changes for the resource type.
	Informer cache.SharedInformer
	// Store is the latest in memory cache for the resource type.
	Store cache.Store
	// TriggerFn must return a function that converts an object returned by the
	// informer into a trigger.CacheEntry and add prefix to the trigger.CacheEntry key.
	TriggerFn func(prefix string) trigger.Indexer
	// Reactor is invoked when an image stream tag change is detected on one or
	// more of the triggers defined on the object.
	Reactor trigger.ImageReactor
}

TriggerSource defines the behavior for given resource type that can be triggered by image stream tag changes.

Jump to

Keyboard shortcuts

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