Bug 1429364 - clear-route-status.sh can not clean the route status using option 'ALL' when there are more than 2 routes
Summary: clear-route-status.sh can not clean the route status using option 'ALL' when ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Networking
Version: 3.5.0
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: Jacob Tanenbaum
QA Contact: zhaozhanqi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-06 08:40 UTC by zhaozhanqi
Modified: 2022-08-04 22:20 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: The command to create a list of routes was incorrect Consequence: Route statuses did not get deleted Fix: Improved the logic enumerating routes Result: Route statuses are correctly cleared
Clone Of:
Environment:
Last Closed: 2017-08-10 05:18:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Origin (Github) 13246 0 None None None 2017-05-15 19:46:35 UTC
Red Hat Product Errata RHEA-2017:1716 0 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.6 RPM Release Advisory 2017-08-10 09:02:50 UTC

Description zhaozhanqi 2017-03-06 08:40:53 UTC
Description of problem:
When using 'ALL' option. eg. './clear-route-status.sh default ALL',it cannot clean the routes status when there are more than 2 routes

Version-Release number of selected component (if applicable):
openshift v3.5.0.37
kubernetes v1.5.2+43a9be4
etcd 3.1.0


How reproducible:
always

Steps to Reproduce:
1. Create two router
    oadm router router1
    oadm router router2
2. Create some route test1 test2

3. delete the router2
   oc delete dc router2
4. get the script 
  wget https://raw.githubusercontent.com/openshift/origin/master/images/router/clear-route-status.sh
5. Clean all routes status 'router2'
./clear-route-status.sh default ALL

6. Check the route stauts 'router2' if has been delted. 
 oc get route -o json | grep router2
  

Actual results:

the status of routerName 'router2'  still exist in all routes

Expected results:

router2 should be deleted for all routes

Additional info:

Comment 1 Jacob Tanenbaum 2017-03-06 14:16:46 UTC
origin PR: https://github.com/openshift/origin/pull/13246

Comment 2 openshift-github-bot 2017-03-07 19:57:15 UTC
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/edef4d133bcaf5c06668c12252122b2800c2df09
correct the ways that routes are iterated over to be cleared

there was an oversight in the way that the clear route status iterated
over the routes returned by

oc get routes -o jsonpath='{.items[*].metadata.name}' --namespace="${namespace}" 2>/dev/null

currently all routes are presented as one string that the server cannot find. Changed that
so that the routes are returned into an array and correctly iterated over so that the server
is given one route name at a time

Bug 1429364
Bug 1429398

Comment 3 Yan Du 2017-03-15 06:11:55 UTC
Test on latest OCP env V3.5.0.52 with the latest script in https://github.com/openshift/origin/pull/13246

Multiple routes in one project could be cleared normally by the script. but after the clear operation, the time of "exposed on router router1 5 minutes ago" have been changed.

Before clear: exposed on router router1 5 minutes ago
$  oc describe route route1 -n d1
Name:			route1
Namespace:		d1
Created:		6 minutes ago
Labels:			name=service-unsecure
Annotations:		openshift.io/host.generated=true
Requested Host:		route1-d1.0313-vn8.qe.rhcloud.com
			  exposed on router router 6 minutes ago
			  exposed on router router1 5 minutes ago  <=========

$ ./clear-route-status.sh d1 ALL
route status for route route1 in namespace d1 cleared
route status for route route2 in namespace d1 cleared
route status for route route3 in namespace d1 cleared

After clear: exposed on router router1 11 seconds ago
$ oc describe route route1 -n d1
Name:			route1
Namespace:		d1
Created:		7 minutes ago
Labels:			name=service-unsecure
Annotations:		openshift.io/host.generated=true
Requested Host:		route1-d1.0313-vn8.qe.rhcloud.com
			  exposed on router router1 11 seconds ago <=========

Comment 4 Eric Paris 2017-03-17 17:22:00 UTC
https://github.com/openshift/origin/issues/13246

Comment 6 Jacob Tanenbaum 2017-04-05 18:23:55 UTC
Yan Du this is expected behaviour, the user is clearing all route statuses and the router has to rewrite it. When writing the status the field retains no state.

Comment 7 Troy Dawson 2017-04-11 21:21:07 UTC
This has been merged into ocp and is in OCP v3.6.27 or newer.

Comment 9 Yan Du 2017-04-12 05:59:21 UTC
Test on latest OCP env, multiple routes in one project could be cleared normally.
oc v3.6.27
kubernetes v1.5.2+43a9be4

# ./clear-route-status.sh d1 ALL
route status for route route1 in namespace d1 cleared
route status for route route2 in namespace d1 cleared
route status for route route3 in namespace d1 cleared

Comment 11 errata-xmlrpc 2017-08-10 05:18:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1716


Note You need to log in before you can comment on or make changes to this bug.