Skip to content

Commit d776f39

Browse files
committed
Use Deployment instead of DeploymentConfig as that is the recommended in newer OCP 4.x
See a note in https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/ "Note: A Deployment that configures a ReplicaSet is now the recommended way to set up replication."
1 parent a1893e6 commit d776f39

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test-lib-openshift.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function ct_os_delete_project() {
339339
# Deletes all objects within the project.
340340
# Handy when we have one project and want to run more tests.
341341
function ct_delete_all_objects() {
342-
for x in bc builds dc is isimage istag po pv pvc rc routes secrets svc ; do
342+
for x in bc builds dc deployment replicaset is isimage istag po pv pvc rc routes secrets svc ; do
343343
oc delete "$x" --all
344344
done
345345
# for some objects it takes longer to be really deleted, so a dummy sleep
@@ -1254,11 +1254,14 @@ function ct_os_service_image_info() {
12541254
local namespace
12551255

12561256
# get image ID from the deployment config
1257-
image_id=$(oc get "deploymentconfig.apps.openshift.io/${service_name}" -o custom-columns=IMAGE:.spec.template.spec.containers[*].image | tail -n 1)
1257+
# In recent OCP 4.x versions, a Deployment that configures a ReplicaSet is
1258+
# now the recommended way to set up replication, instead of DeploymentConfig
1259+
# configuring ReplicationController. So, trying both one after another.
1260+
image_id=$( (oc get "deploymentconfig.apps.openshift.io/${service_name}" -o custom-columns=IMAGE:.spec.template.spec.containers[*].image \
1261+
|| oc get "deployments/${service_name}" -o custom-columns=IMAGE:.spec.template.spec.containers[*].image ) | tail -n 1)
12581262
namespace=${CT_NAMESPACE:-"$(oc project -q)"}
12591263

1260-
echo " Information about the image we work with:"
1261-
oc get deploymentconfig.apps.openshift.io/"${service_name}" -o yaml | grep lastTriggeredImage
1264+
echo " Information about the image we work with: ${image_id}"
12621265
# for s2i builds, the resulting image is actually in the current namespace,
12631266
# so if the specified namespace does not succeed, try the current namespace
12641267
oc get isimage -n "${namespace}" "${image_id##*/}" -o yaml || oc get isimage "${image_id##*/}" -o yaml

0 commit comments

Comments
 (0)