Browse Source

Migration from DeploymentConfig to Deployment

For more information see
https://docs.openshift.com/container-platform/4.12/applications/deployments/what-deployments-are.html

Since OpenShift 4.14 DeploymentConfigs are deprecated. https://access.redhat.com/articles/7041372

Strategy 'Rolling' does not exist in Deployments and has to be migrated
to 'RollingUpdate' as well.

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
pull/211/head
Petr "Stone" Hracek 2 years ago
parent
commit
37ccba86a5
3 changed files with 36 additions and 113 deletions
  1. +14
    -45
      openshift/templates/django-postgresql-persistent.json
  2. +14
    -45
      openshift/templates/django-postgresql.json
  3. +8
    -23
      openshift/templates/django.json

+ 14
- 45
openshift/templates/django-postgresql-persistent.json View File

@ -141,40 +141,25 @@
} }
}, },
{ {
"kind": "DeploymentConfig",
"apiVersion": "apps.openshift.io/v1",
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": { "metadata": {
"name": "${NAME}", "name": "${NAME}",
"annotations": { "annotations": {
"description": "Defines how to deploy the application server", "description": "Defines how to deploy the application server",
"template.alpha.openshift.io/wait-for-ready": "true"
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
} }
}, },
"spec": { "spec": {
"strategy": { "strategy": {
"type": "Recreate" "type": "Recreate"
}, },
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"django-psql-persistent"
],
"from": {
"kind": "ImageStreamTag",
"name": "${NAME}:latest"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1, "replicas": 1,
"selector": { "selector": {
"name": "${NAME}"
"matchLabels":{
"name": "${NAME}"
}
}, },
"template": { "template": {
"metadata": { "metadata": {
@ -305,41 +290,25 @@
} }
}, },
{ {
"kind": "DeploymentConfig",
"apiVersion": "apps.openshift.io/v1",
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": { "metadata": {
"name": "${DATABASE_SERVICE_NAME}", "name": "${DATABASE_SERVICE_NAME}",
"annotations": { "annotations": {
"description": "Defines how to deploy the database", "description": "Defines how to deploy the database",
"template.alpha.openshift.io/wait-for-ready": "true"
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
} }
}, },
"spec": { "spec": {
"strategy": { "strategy": {
"type": "Recreate" "type": "Recreate"
}, },
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"postgresql"
],
"from": {
"kind": "ImageStreamTag",
"namespace": "${NAMESPACE}",
"name": "postgresql:${POSTGRESQL_VERSION}"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1, "replicas": 1,
"selector": { "selector": {
"name": "${DATABASE_SERVICE_NAME}"
"matchLabels":{
"name": "${DATABASE_SERVICE_NAME}"
}
}, },
"template": { "template": {
"metadata": { "metadata": {


+ 14
- 45
openshift/templates/django-postgresql.json View File

@ -141,40 +141,25 @@
} }
}, },
{ {
"kind": "DeploymentConfig",
"apiVersion": "apps.openshift.io/v1",
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": { "metadata": {
"name": "${NAME}", "name": "${NAME}",
"annotations": { "annotations": {
"description": "Defines how to deploy the application server", "description": "Defines how to deploy the application server",
"template.alpha.openshift.io/wait-for-ready": "true"
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
} }
}, },
"spec": { "spec": {
"strategy": { "strategy": {
"type": "Recreate" "type": "Recreate"
}, },
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"django-psql-example"
],
"from": {
"kind": "ImageStreamTag",
"name": "${NAME}:latest"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1, "replicas": 1,
"selector": { "selector": {
"name": "${NAME}"
"matchLabels":{
"name": "${NAME}"
}
}, },
"template": { "template": {
"metadata": { "metadata": {
@ -288,41 +273,25 @@
} }
}, },
{ {
"kind": "DeploymentConfig",
"apiVersion": "apps.openshift.io/v1",
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": { "metadata": {
"name": "${DATABASE_SERVICE_NAME}", "name": "${DATABASE_SERVICE_NAME}",
"annotations": { "annotations": {
"description": "Defines how to deploy the database", "description": "Defines how to deploy the database",
"template.alpha.openshift.io/wait-for-ready": "true"
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
} }
}, },
"spec": { "spec": {
"strategy": { "strategy": {
"type": "Recreate" "type": "Recreate"
}, },
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"postgresql"
],
"from": {
"kind": "ImageStreamTag",
"namespace": "${NAMESPACE}",
"name": "postgresql:${POSTGRESQL_VERSION}"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1, "replicas": 1,
"selector": { "selector": {
"name": "${DATABASE_SERVICE_NAME}"
"matchLabels":{
"name": "${DATABASE_SERVICE_NAME}"
}
}, },
"template": { "template": {
"metadata": { "metadata": {


+ 8
- 23
openshift/templates/django.json View File

@ -138,40 +138,25 @@
} }
}, },
{ {
"kind": "DeploymentConfig",
"apiVersion": "apps.openshift.io/v1",
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": { "metadata": {
"name": "${NAME}", "name": "${NAME}",
"annotations": { "annotations": {
"description": "Defines how to deploy the application server", "description": "Defines how to deploy the application server",
"template.alpha.openshift.io/wait-for-ready": "true"
"template.alpha.openshift.io/wait-for-ready": "true",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
} }
}, },
"spec": { "spec": {
"strategy": { "strategy": {
"type": "Rolling"
"type": "RollingUpdate"
}, },
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"django-example"
],
"from": {
"kind": "ImageStreamTag",
"name": "${NAME}:latest"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1, "replicas": 1,
"selector": { "selector": {
"name": "${NAME}"
"matchLabels":{
"name": "${NAME}"
}
}, },
"template": { "template": {
"metadata": { "metadata": {


Loading…
Cancel
Save