Skip to content

Commit c0f7342

Browse files
authored
Merge pull request #219 from sclorg/migrate_deployment
Migrate DeploymentConfig to Deployment
2 parents 63e0ba6 + 48897c4 commit c0f7342

File tree

3 files changed

+32
-49
lines changed

3 files changed

+32
-49
lines changed

examples/mariadb-ephemeral-template.json

+7-23
Original file line numberDiff line numberDiff line change
@@ -61,40 +61,24 @@
6161
}
6262
},
6363
{
64-
"kind": "DeploymentConfig",
65-
"apiVersion": "apps.openshift.io/v1",
64+
"kind": "Deployment",
65+
"apiVersion": "apps/v1",
6666
"metadata": {
6767
"name": "${DATABASE_SERVICE_NAME}",
6868
"annotations": {
69-
"template.alpha.openshift.io/wait-for-ready": "true"
69+
"template.alpha.openshift.io/wait-for-ready": "true",
70+
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mariadb:${MARIADB_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
7071
}
7172
},
7273
"spec": {
7374
"strategy": {
7475
"type": "Recreate"
7576
},
76-
"triggers": [
77-
{
78-
"type": "ImageChange",
79-
"imageChangeParams": {
80-
"automatic": true,
81-
"containerNames": [
82-
"mariadb"
83-
],
84-
"from": {
85-
"kind": "ImageStreamTag",
86-
"name": "mariadb:${MARIADB_VERSION}",
87-
"namespace": "${NAMESPACE}"
88-
}
89-
}
90-
},
91-
{
92-
"type": "ConfigChange"
93-
}
94-
],
9577
"replicas": 1,
9678
"selector": {
97-
"name": "${DATABASE_SERVICE_NAME}"
79+
"matchLabels": {
80+
"name": "${DATABASE_SERVICE_NAME}"
81+
}
9882
},
9983
"template": {
10084
"metadata": {

examples/mariadb-persistent-template.json

+7-23
Original file line numberDiff line numberDiff line change
@@ -78,40 +78,24 @@
7878
}
7979
},
8080
{
81-
"kind": "DeploymentConfig",
82-
"apiVersion": "apps.openshift.io/v1",
81+
"kind": "Deployment",
82+
"apiVersion": "apps/v1",
8383
"metadata": {
8484
"name": "${DATABASE_SERVICE_NAME}",
8585
"annotations": {
86-
"template.alpha.openshift.io/wait-for-ready": "true"
86+
"template.alpha.openshift.io/wait-for-ready": "true",
87+
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mariadb:${MARIADB_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
8788
}
8889
},
8990
"spec": {
9091
"strategy": {
9192
"type": "Recreate"
9293
},
93-
"triggers": [
94-
{
95-
"type": "ImageChange",
96-
"imageChangeParams": {
97-
"automatic": true,
98-
"containerNames": [
99-
"mariadb"
100-
],
101-
"from": {
102-
"kind": "ImageStreamTag",
103-
"name": "mariadb:${MARIADB_VERSION}",
104-
"namespace": "${NAMESPACE}"
105-
}
106-
}
107-
},
108-
{
109-
"type": "ConfigChange"
110-
}
111-
],
11294
"replicas": 1,
11395
"selector": {
114-
"name": "${DATABASE_SERVICE_NAME}"
96+
"matchLabels": {
97+
"name": "${DATABASE_SERVICE_NAME}"
98+
}
11599
},
116100
"template": {
117101
"metadata": {

test/test-lib-mysql.sh

+18-3
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,17 @@ function test_mariadb_integration() {
116116
local service_name=mariadb
117117
TEMPLATES="mariadb-ephemeral-template.json
118118
mariadb-persistent-template.json"
119+
SHORT_VERSION="${VERSION//.}"
120+
if [ "${OS}" == "rhel7" ]; then
121+
namespace_image="rhscl/mariadb-${SHORT_VERSION}-rhel7"
122+
else
123+
namespace_image="${OS}/mariadb-${SHORT_VERSION}"
124+
fi
119125
for template in $TEMPLATES; do
120126
ct_os_test_template_app_func "${IMAGE_NAME}" \
121127
"${THISDIR}/${template}" \
122128
"${service_name}" \
123-
"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" \
129+
"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" \
124130
"-p MARIADB_VERSION=${VERSION} \
125131
-p DATABASE_SERVICE_NAME="${service_name}-testing" \
126132
-p MYSQL_USER=testu \
@@ -137,13 +143,22 @@ function test_mariadb_imagestream() {
137143
elif [ "${OS}" == "rhel9" ]; then
138144
tag="-el9"
139145
fi
140-
ct_os_test_image_stream_template "${THISDIR}/imagestreams/mariadb-${OS%[0-9]*}.json" "${THISDIR}/examples/mariadb-ephemeral-template.json" mariadb "-p MARIADB_VERSION=${VERSION}${tag}"
146+
TEMPLATES="mariadb-ephemeral-template.json
147+
mariadb-persistent-template.json"
148+
for template in $TEMPLATES; do
149+
ct_os_test_image_stream_template "${THISDIR}/imagestreams/mariadb-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" mariadb "-p MARIADB_VERSION=${VERSION}${tag}"
150+
done
141151
}
142152

143153
function test_mariadb_template() {
144-
ct_os_test_image_stream_template "${THISDIR}/imagestreams/mariadb-${OS%[0-9]*}.json" "${THISDIR}/mariadb-ephemeral-template.json" mariadb
154+
TEMPLATES="mariadb-ephemeral-template.json
155+
mariadb-persistent-template.json"
156+
for template in $TEMPLATES; do
157+
ct_os_test_image_stream_template "${THISDIR}/imagestreams/mariadb-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" mariadb
158+
done
145159
}
146160

161+
147162
# Check the latest imagestreams
148163
function run_latest_imagestreams() {
149164
local result=1

0 commit comments

Comments
 (0)