Skip to content

Commit

Permalink
Merge pull request #159 from sclorg/migrate_deployment
Browse files Browse the repository at this point in the history
Migrate from DeploymentConfig to Deployment
  • Loading branch information
phracek committed Dec 5, 2023
2 parents 710d98c + effc0f0 commit 073d3da
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 52 deletions.
31 changes: 7 additions & 24 deletions examples/redis-ephemeral-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,41 +62,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\":\"redis:${REDIS_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"redis"
],
"from": {
"kind": "ImageStreamTag",
"name": "redis:${REDIS_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/redis-persistent-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,41 +79,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\":\"redis:${REDIS_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
}
},
"spec": {
"strategy": {
"type": "Recreate"
},
"triggers": [
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"redis"
],
"from": {
"kind": "ImageStreamTag",
"name": "redis:${REDIS_VERSION}",
"namespace": "${NAMESPACE}"
},
"lastTriggeredImage": ""
}
},
{
"type": "ConfigChange"
}
],
"replicas": 1,
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
"matchLabels": {
"name": "${DATABASE_SERVICE_NAME}"
}
},
"template": {
"metadata": {
Expand Down
21 changes: 17 additions & 4 deletions test/test-lib-redis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ source "${THISDIR}/test-lib-remote-openshift.sh"

function test_redis_integration() {
local service_name=redis
ct_os_test_template_app_func "${IMAGE_NAME}" \
"https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/redis-ephemeral-template.json" \
if [ "${OS}" == "rhel7" ]; then
namespace_image="rhscl/redis-${VERSION}-rhel7"
else
namespace_image="${OS}/redis-${VERSION}"
fi
TEMPLATES="redis-ephemeral-template.json
redis-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' 'timeout 15 redis-cli -h <IP> -a testp ping' 'PONG'" \
"ct_os_check_cmd_internal 'registry.redhat.io/${namespace_image}' '${service_name}-testing' 'timeout 15 redis-cli -h <IP> -a testp ping' 'PONG'" \
"-p REDIS_VERSION=${VERSION} \
-p DATABASE_SERVICE_NAME="${service_name}-testing" \
-p REDIS_PASSWORD=testp"
done
}

# Check the imagestream
Expand All @@ -35,7 +44,11 @@ function test_redis_imagestream() {
elif [ "${OS}" == "rhel9" ]; then
tag="-el9"
fi
ct_os_test_image_stream_template "${THISDIR}/imagestreams/redis-${OS%[0-9]*}.json" "${THISDIR}/examples/redis-ephemeral-template.json" redis "-p REDIS_VERSION=${VERSION}${tag}"
TEMPLATES="redis-ephemeral-template.json
redis-persistent-template.json"
for template in $TEMPLATES; do
ct_os_test_image_stream_template "${THISDIR}/imagestreams/redis-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" redis "-p REDIS_VERSION=${VERSION}${tag}"
done
}

function test_latest_imagestreams() {
Expand Down

0 comments on commit 073d3da

Please sign in to comment.