mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
74 lines
2.6 KiB
Plaintext
74 lines
2.6 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * applications/deployments/managing-deployment-processes.adoc
|
|
|
|
:_mod-docs-content-type: CONCEPT
|
|
[id="deployments-triggers_{context}"]
|
|
= Deployment triggers
|
|
|
|
A `DeploymentConfig` object can contain triggers, which drive the creation of new deployment processes in response to events inside the cluster.
|
|
|
|
[WARNING]
|
|
====
|
|
If no triggers are defined on a `DeploymentConfig` object, a config change trigger is added by default. If triggers are defined as an empty field, deployments must be started manually.
|
|
====
|
|
|
|
[id="deployments-configchange-trigger_{context}"]
|
|
== Config change deployment triggers
|
|
|
|
The config change trigger results in a new replication controller whenever configuration changes are detected in the pod template of the `DeploymentConfig` object.
|
|
|
|
[NOTE]
|
|
====
|
|
If a config change trigger is defined on a `DeploymentConfig` object, the first replication controller is automatically created soon after the `DeploymentConfig` object itself is created and it is not paused.
|
|
====
|
|
|
|
.Config change deployment trigger
|
|
[source,yaml]
|
|
----
|
|
kind: DeploymentConfig
|
|
apiVersion: apps.openshift.io/v1
|
|
metadata:
|
|
name: example-dc
|
|
# ...
|
|
spec:
|
|
# ...
|
|
triggers:
|
|
- type: "ConfigChange"
|
|
----
|
|
|
|
[id="deployments-imagechange-trigger_{context}"]
|
|
== Image change deployment triggers
|
|
|
|
The image change trigger results in a new replication controller whenever the content of an image stream tag changes (when a new version of the image is pushed).
|
|
|
|
.Image change deployment trigger
|
|
[source,yaml]
|
|
----
|
|
kind: DeploymentConfig
|
|
apiVersion: apps.openshift.io/v1
|
|
metadata:
|
|
name: example-dc
|
|
# ...
|
|
spec:
|
|
# ...
|
|
triggers:
|
|
- type: "ImageChange"
|
|
imageChangeParams:
|
|
automatic: true <1>
|
|
from:
|
|
kind: "ImageStreamTag"
|
|
name: "origin-ruby-sample:latest"
|
|
namespace: "myproject"
|
|
containerNames:
|
|
- "helloworld"
|
|
----
|
|
<1> If the `imageChangeParams.automatic` field is set to `false`, the trigger is disabled.
|
|
|
|
With the above example, when the `latest` tag value of the `origin-ruby-sample` image stream changes and the new image value differs from the current image specified in the `DeploymentConfig` object's `helloworld` container, a new replication controller is created using the new image for the `helloworld` container.
|
|
|
|
[NOTE]
|
|
====
|
|
If an image change trigger is defined on a `DeploymentConfig` object (with a config change trigger and `automatic=false`, or with `automatic=true`) and the image stream tag pointed by the image change trigger does not exist yet, the initial deployment process will automatically start as soon as an image is imported or pushed by a build to the image stream tag.
|
|
====
|