Appendix C. OpenShift Template modifications
An existing OpenShift example application nodejs-ex was used for this project. It provides an OpenShift Template requiring modification to support the image promotion and deployment process. Below is an annotated list of modified sections.
ImageStream
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "${NAME}",
"annotations": {
"description": "Keeps track of changes in the application image",
"openshift.io/image.insecureRepository": "true"
}
},
"spec": {
"tags": [
{
"from": {
"kind": "DockerImage", 1
"name": "${REGISTRY}/${REGISTRY_PROJECT}/${NAME}:${TAG}" 2
},
"name": "${IMAGESTREAM_TAG}", 3
"importPolicy": {
"insecure": true,
"scheduled": true 4
}
}
]
}
},
- 1
- Since an external registry is used the tags kind will be
DockerImage. - 2
namepoints to the url of the Docker image including the specific tag that will be imported.- 3
- This is the tag of the ImageStream within the project that will be deployed.
- 4
- Keep the image up to do date based on any changes in the source registry.
BuildConfig
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "${NAME}",
"annotations": {
"description": "Defines how to build the application",
"template.alpha.openshift.io/wait-for-ready": "true"
}
},
"spec": {
"source": {
"type": "Git",
"git": {
"uri": "${SOURCE_REPOSITORY_URL}",
"ref": "${SOURCE_REPOSITORY_REF}"
},
"contextDir": "${CONTEXT_DIR}"
},
"strategy": {
"type": "Source",
"sourceStrategy": {
"from": {
"kind": "ImageStreamTag",
"namespace": "${NAMESPACE}",
"name": "nodejs:6"
},
"env": [
{
"name": "NPM_MIRROR",
"value": "${NPM_MIRROR}"
}
]
}
},
"output": {
"to": {
"kind": "DockerImage", 1
"name": "${REGISTRY}/${REGISTRY_PROJECT}/${NAME}:${TAG}" 2
}
},
"triggers": [], 3
"postCommit": {
"script": "npm test"
}
}
},
DeploymentConfig
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "${NAME}",
"annotations": {
"description": "Defines how to deploy the application server",
"template.alpha.openshift.io/wait-for-ready": "true"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [ 1
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": false, 2
"containerNames": [
"nodejs-mongo-persistent"
],
"from": {
"kind": "ImageStreamTag",
"name": "${NAME}:${IMAGESTREAM_TAG}" 3
}
}
}
],
... [OUTPUT ABBREVIATED] ...
Parameters
... [OUTPUT ABBREVIATED] ...
{
"name": "TAG", 1
"displayName": "Current Docker image tag in registry",
"description": "",
"required": true
},
{
"name": "IMAGESTREAM_TAG", 2
"displayName": "Current ImageStreamTag in OpenShift",
"description": "",
"required": true
},
{
"name": "REGISTRY", 3
"displayName": "Registry",
"description": "The URL of the registry where the image resides",
"required": true
},
{
"name": "REGISTRY_PROJECT", 4
"displayName": "The registry project where the image resides.",
"description": "",
"required": true
},
... [OUTPUT ABBREVIATED] ...

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.