Skip to content

Commit

Permalink
Merge pull request #353 from sclorg/migrate_deployment
Browse files Browse the repository at this point in the history
Migrate DeploymentConfig to Deployments
  • Loading branch information
phracek authored Dec 5, 2023
2 parents 5bf11bb + a096922 commit f083ddb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 51 deletions.
31 changes: 7 additions & 24 deletions examples/mysql-ephemeral-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,41 +69,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\":\"mysql:${MYSQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"mysql"
],
"from": {
"kind": "ImageStreamTag",
"name": "mysql:${MYSQL_VERSION}",
"namespace": "${NAMESPACE}"
},
"lastTriggeredImage": ""
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
"matchLabels": {
"name": "${DATABASE_SERVICE_NAME}"
}
},
"template": {
"metadata": {
Expand Down
34 changes: 10 additions & 24 deletions examples/mysql-persistent-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"metadata": {
"name": "${DATABASE_SERVICE_NAME}",
"annotations": {
"template.openshift.io/expose-uri": "mysql://{.spec.clusterIP}:{.spec.ports[?(.name==\"mysql\")].port}"
"template.openshift.io/expose-uri": "mysql://{.spec.clusterIP}:{.spec.ports[?(.name==\"mysql\")].port}",
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MARIADB_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
}
},
"spec": {
Expand Down Expand Up @@ -78,41 +79,26 @@
}
},
{
"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\":\"mysql:${MYSQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"mysql"
],
"from": {
"kind": "ImageStreamTag",
"name": "mysql:${MYSQL_VERSION}",
"namespace": "${NAMESPACE}"
}
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
"matchLabels": {
"name": "${DATABASE_SERVICE_NAME}"
}
},

"template": {
"metadata": {
"labels": {
Expand Down
14 changes: 11 additions & 3 deletions test/test-lib-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,16 @@ function test_mysql_integration() {
local service_name=mysql
TEMPLATES="mysql-ephemeral-template.json
mysql-persistent-template.json"

if [ "${OS}" == "rhel7" ]; then
namespace_image="rhscl/mysql-80-rhel7"
else
namespace_image="${OS}/mysql-80"
fi
for template in $TEMPLATES; do
ct_os_test_template_app_func "${IMAGE_NAME}" \
"${THISDIR}/${template}" \
"${service_name}" \
"ct_os_check_cmd_internal '<SAME_IMAGE>' '${service_name}-testing' \"echo 'SELECT 42 as testval\g' | mysql --connect-timeout=15 -h <IP> testdb -utestu -ptestp\" '^42' 120" \
"ct_os_check_cmd_internal 'registry.redhat.io/${namespace_image}' '${service_name}-testing' \"echo 'SELECT 42 as testval\g' | mysql --connect-timeout=15 -h <IP> testdb -utestu -ptestp\" '^42' 120" \
"-p MYSQL_VERSION=${VERSION} \
-p DATABASE_SERVICE_NAME="${service_name}-testing" \
-p MYSQL_USER=testu \
Expand All @@ -138,7 +142,11 @@ function test_mysql_imagestream() {
elif [ "${OS}" == "rhel9" ]; then
tag="-el9"
fi
ct_os_test_image_stream_template "${THISDIR}/imagestreams/mysql-${OS%[0-9]*}.json" "${THISDIR}/examples/mysql-ephemeral-template.json" mysql "-p MYSQL_VERSION=${VERSION}${tag}"
TEMPLATES="mysql-ephemeral-template.json
mysql-persistent-template.json"
for template in $TEMPLATES; do
ct_os_test_image_stream_template "${THISDIR}/imagestreams/mysql-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" mysql "-p MYSQL_VERSION=${VERSION}${tag}"
done
}


Expand Down

0 comments on commit f083ddb

Please sign in to comment.