Documentation ¶
Index ¶
- Variables
- func NewTagRetriever(lister ImageStreamLister) trigger.TagRetriever
- func NewTriggerCache() cache.ThreadSafeStore
- func NewTriggerEventBroadcaster(client kv1core.CoreV1Interface) record.EventBroadcaster
- func ProcessEvents(c cache.ThreadSafeStore, indexer trigger.Indexer, ...) cache.ResourceEventHandler
- type ImageStreamLister
- type ImageStreamNamespaceLister
- type StoreToImageStreamLister
- type TriggerController
- type TriggerSource
Constants ¶
This section is empty.
Variables ¶
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 ¶
func NewTagRetriever(lister ImageStreamLister) trigger.TagRetriever
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 ¶
func ProcessEvents(c cache.ThreadSafeStore, indexer trigger.Indexer, queue workqueue.RateLimitingInterface, tags trigger.TagRetriever) cache.ResourceEventHandler
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 ImageStreamLister ¶
type ImageStreamLister interface { // ImageStreams returns an object that can get ImageStreams. ImageStreams(namespace string) ImageStreamNamespaceLister }
ImageStreamLister is the subset interface required off an ImageStream client to implement this controller. TODO: replace with generated informer interfaces
type ImageStreamNamespaceLister ¶
type ImageStreamNamespaceLister interface { // Get retrieves the Deployment from the indexer for a given namespace and name. Get(name string, options metav1.GetOptions) (*imageapi.ImageStream, error) }
ImageStreamNamespaceLister helps get ImageStreams. TODO: replace with generated informer interfaces
type StoreToImageStreamLister ¶
StoreToImageStreamLister adapts a cache.Store to ImageStreamLister TODO: replace with generated informer interfaces
func (StoreToImageStreamLister) ImageStreams ¶
func (s StoreToImageStreamLister) ImageStreams(namespace string) ImageStreamNamespaceLister
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 cache.SharedInformer, lister ImageStreamLister, 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.