trigger

package
v0.0.0-...-f8abdcd Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const TriggerAnnotationKey = "image.openshift.io/triggers"

TriggerAnnotationKey is the annotation used on resources to signal they wish to have container image references changed when an image stream tag is updated. Today, only containers can be specified by fieldPath.

Variables

This section is empty.

Functions

func ContainerForObjectFieldPath

func ContainerForObjectFieldPath(obj runtime.Object, fieldPath string) (referencemutator.ContainerMutator, string, error)

ContainerForObjectFieldPath returns a reference to the container in the object with pod spec underneath fieldPath. Returns error if no such container exists or the field path is invalid. Returns the remaining field path beyond the container, if any.

func ContainerImageChanged

func ContainerImageChanged(oldObj, newObj runtime.Object, newTriggers []ObjectFieldTrigger) bool

ContainerImageChanged returns true if any container image referenced by newTriggers changed.

func UpdateObjectFromImages

func UpdateObjectFromImages(obj runtime.Object, tagRetriever TagRetriever) (runtime.Object, error)

UpdateObjectFromImages attempts to set the appropriate object information. If changes are necessary, it lazily copies obj and returns it, or if no changes are necessary returns nil.

Types

type AnnotationReactor

type AnnotationReactor struct {
	Updater AnnotationUpdater
}

func (*AnnotationReactor) ImageChanged

func (r *AnnotationReactor) ImageChanged(obj runtime.Object, tagRetriever TagRetriever) error

type AnnotationUpdater

type AnnotationUpdater interface {
	Update(obj runtime.Object) error
}

type ObjectFieldTrigger

type ObjectFieldTrigger struct {
	// from is the object this should trigger from. The kind and name fields must be set.
	From ObjectReference `json:"from"`
	// fieldPath is a JSONPath string to the field to edit on the object. Required.
	FieldPath string `json:"fieldPath"`
	// paused is true if this trigger is temporarily disabled. Optional.
	Paused bool `json:"paused,omitempty"`
}

ObjectFieldTrigger links a field on the current object to another object for mutation.

func CalculateAnnotationTriggers

func CalculateAnnotationTriggers(m metav1.Object, prefix string) (string, string, []ObjectFieldTrigger, error)

type ObjectReference

type ObjectReference struct {
	// kind is the referenced object's schema.
	Kind string `json:"kind"`
	// name is the name of the object.
	Name string `json:"name"`
	// namespace is the namespace the object is located in. Optional if the object is not
	// namespaced, or if left empty on a namespaced object, means the current namespace.
	Namespace string `json:"namespace,omitempty"`
	// apiVersion is the group and version the type exists in. Optional.
	APIVersion string `json:"apiVersion,omitempty"`
}

ObjectReference identifies an object by its name and kind.

type TagRetriever

type TagRetriever interface {
	ImageStreamTag(namespace, name string) (ref string, rv int64, ok bool)
}

TagRetriever returns information about a tag, including whether it exists and the observed resource version of the object at the time the tag was loaded.

Jump to

Keyboard shortcuts

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