Skip to content

Commit

Permalink
Merge pull request #540 from sclorg/migrate_deployment
Browse files Browse the repository at this point in the history
Migrate DeploymentsConfig to Deployment
  • Loading branch information
phracek authored Dec 5, 2023
2 parents 44724a4 + e7579c9 commit 2882158
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 51 deletions.
31 changes: 7 additions & 24 deletions examples/postgresql-ephemeral-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,41 +66,24 @@
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "apps.openshift.io/v1",
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"annotations": {
"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": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"postgresql"
],
"from": {
"kind": "ImageStreamTag",
"name": "postgresql:${POSTGRESQL_VERSION}",
"namespace": "${NAMESPACE}"
},
"lastTriggeredImage": ""
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
"matchLabels": {
"name": "${DATABASE_SERVICE_NAME}"
}
},
"template": {
"metadata": {
Expand Down
31 changes: 7 additions & 24 deletions examples/postgresql-persistent-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,41 +83,24 @@
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "apps.openshift.io/v1",
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"annotations": {
"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": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"postgresql"
],
"from": {
"kind": "ImageStreamTag",
"name": "postgresql:${POSTGRESQL_VERSION}",
"namespace": "${NAMESPACE}"
},
"lastTriggeredImage": ""
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
"matchLabels": {
"name": "${DATABASE_SERVICE_NAME}"
}
},
"template": {
"metadata": {
Expand Down
14 changes: 11 additions & 3 deletions test/test-lib-postgresql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ source "${THISDIR}"/test-lib-remote-openshift.sh

function test_postgresql_integration() {
local service_name=postgresql
if [ "${OS}" == "rhel7" ]; then
namespace_image="rhscl/postgresql-${VERSION}-rhel7"
else
namespace_image="${OS}/postgresql-${VERSION}"
fi
TEMPLATES="postgresql-ephemeral-template.json
postgresql-persistent-template.json"
for template in $TEMPLATES; do
ct_os_test_template_app_func "${IMAGE_NAME}" \
"${THISDIR}/examples/${template}" \
"${service_name}" \
"ct_os_check_cmd_internal '<SAME_IMAGE>' '${service_name}-testing' 'PGPASSWORD=testp pg_isready -t 15 -h <IP> -U testu -d testdb' 'accepting connections' 120" \
"ct_os_check_cmd_internal 'registry.redhat.io/${namespace_image}' '${service_name}-testing' 'PGPASSWORD=testp pg_isready -t 15 -h <IP> -U testu -d testdb' 'accepting connections' 120" \
"-p POSTGRESQL_VERSION=${VERSION} \
-p DATABASE_SERVICE_NAME="${service_name}-testing" \
-p POSTGRESQL_USER=testu \
Expand All @@ -37,8 +42,11 @@ function test_postgresql_imagestream() {
elif [ "${OS}" == "rhel9" ]; then
tag="-el9"
fi

ct_os_test_image_stream_template "${THISDIR}/imagestreams/postgresql-${OS%[0-9]*}.json" "${THISDIR}/examples/postgresql-ephemeral-template.json" postgresql "-p POSTGRESQL_VERSION=${VERSION}${tag}"
TEMPLATES="postgresql-ephemeral-template.json
postgresql-persistent-template.json"
for template in $TEMPLATES; do
ct_os_test_image_stream_template "${THISDIR}/imagestreams/postgresql-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" postgresql "-p POSTGRESQL_VERSION=${VERSION}${tag}"
done
}


Expand Down

0 comments on commit 2882158

Please sign in to comment.