Triggering updates on image stream changes
OKD deployment configurations and build configurations can be automatically triggered by changes to image stream tags. The triggered action can be run using the new value of the image referenced by the updated image stream tag.
Kubernetes resources do not have fields for triggering, unlike deployment and build configurations, which include as part of their API definition a set of fields for controlling triggers. Instead, you can use annotations in OKD to request triggering.
The annotation is defined as follows:
When one of the core Kubernetes resources contains both a pod template and this annotation, OKD attempts to update the object by using the image currently associated with the image stream tag that is referenced by trigger. The update is performed against the fieldPath
specified.
Deployments
StatefulSets
DaemonSets
ReplicationControllers
When adding an image trigger to deployments, you can use the oc set triggers
command. For example, the sample command in this procedure adds an image change trigger to the deployment named example
so that when the example:latest
image stream tag is updated, the web
container inside the deployment updates with the new image value. This command sets the correct image.openshift.io/triggers
annotation on the deployment resource.
Procedure
Unless the deployment is paused, this pod template update automatically causes a deployment to occur with the new image value.