Building on replication controllers, OpenShift Container Platform adds expanded support
for the software development and deployment lifecycle with the concept
of deployments. In the simplest case, a deployment just creates a new
replication controller and lets it start up pods. However, OpenShift Container Platform
deployments also provide the ability to transition from an existing
deployment of an image to a new one and also define hooks to be run
before or after creating the replication controller.
The OpenShift Container Platform DeploymentConfig
object defines the following
details of a deployment:
-
The elements of a ReplicationController
definition.
-
Triggers for creating a new deployment automatically.
-
The strategy for transitioning between deployments.
-
Life cycle hooks.
Each time a deployment is triggered, whether manually or automatically,
a deployer pod manages the deployment (including scaling down the old
replication controller, scaling up the new one, and running hooks).
The deployment pod remains for an indefinite amount of time after it
completes the deployment in order to retain its logs of the deployment.
When a deployment is superseded by another, the previous replication
controller is retained to enable easy rollback if needed.
For detailed instructions on how to create and interact with deployments,
refer to Deployments.
Here is an example DeploymentConfig
definition with some
omissions and callouts:
apiVersion: v1
kind: DeploymentConfig
metadata:
name: frontend
spec:
replicas: 5
selector:
name: frontend
template: { ... }
triggers:
- type: ConfigChange (1)
- imageChangeParams:
automatic: true
containerNames:
- helloworld
from:
kind: ImageStreamTag
name: hello-openshift:latest
type: ImageChange (2)
strategy:
type: Rolling (3)
-
A ConfigChange
trigger causes a new deployment to be created any time the replication controller template changes.
-
An ImageChange
trigger causes a new deployment to be created each time a new version of the backing image is available in the named image stream.
-
The default Rolling
strategy makes a downtime-free transition between deployments.