diff --git a/examples/mysql-ephemeral-template.json b/examples/mysql-ephemeral-template.json index 9e1c89b..118c105 100644 --- a/examples/mysql-ephemeral-template.json +++ b/examples/mysql-ephemeral-template.json @@ -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": { diff --git a/examples/mysql-persistent-template.json b/examples/mysql-persistent-template.json index 501a70f..76716a8 100644 --- a/examples/mysql-persistent-template.json +++ b/examples/mysql-persistent-template.json @@ -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": { @@ -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": { diff --git a/test/test-lib-mysql.sh b/test/test-lib-mysql.sh index 9dcb6d7..59f9a00 100755 --- a/test/test-lib-mysql.sh +++ b/test/test-lib-mysql.sh @@ -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 '' '${service_name}-testing' \"echo 'SELECT 42 as testval\g' | mysql --connect-timeout=15 -h 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 testdb -utestu -ptestp\" '^42' 120" \ "-p MYSQL_VERSION=${VERSION} \ -p DATABASE_SERVICE_NAME="${service_name}-testing" \ -p MYSQL_USER=testu \ @@ -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 }