Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1429398 - clear-route-status.sh can not clean the route stale status field by using '-r' option
clear-route-status.sh can not clean the route stale status field by using '-r...
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Routing (Show other bugs)
3.5.0
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: jtanenba
zhaozhanqi
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-06 04:58 EST by Yan Du
Modified: 2017-08-16 15 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: The script does not check the version of jq and does not populate its array of routes correctly Consequence: When using the -r the script failes Fix: Check to makes sure the user has an appropriate version of jq and populate the array of target routes properly Result: The script correctly clears the routes specified of status messages
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-10 01:18:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Origin (Github) 13246 None None None 2017-03-06 09:15 EST
Origin (Github) 14200 None None None 2017-05-15 14:00 EDT
Red Hat Product Errata RHEA-2017:1716 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.6 RPM Release Advisory 2017-08-10 05:02:50 EDT

  None (edit)
Description Yan Du 2017-03-06 04:58:59 EST
Description of problem:
clear-route-status.sh can not clean the route stale status field by using '-r' option

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


How reproducible:
always

Steps to Reproduce:
1. Create router
2. Create some routes
3. Delete the old router and recreate a new router named router1
4. Clear the status set by a specific router
$ wget https://raw.githubusercontent.com/openshift/origin/master/images/router/clear-route-status.sh
$ ./clear-route-status.sh -r router


Actual results:
$ ./clear-route-status.sh -r router
Error from server (NotFound): routes "docker-registry registry-console" not found

Expected results:
Should not show route could not found, since the routes are existed, and the status fields for old router could be cleared.
# oc describe route docker-registry
Name:            docker-registry
Namespace:        default
Created:        31 hours ago
Labels:            <none>
Annotations:        openshift.io/host.generated=true
Requested Host:        docker-registry-default.0305-mnr.qe.rhcloud.com
              exposed on router router 31 hours ago
              exposed on router router1 17 minutes ago
Comment 1 jtanenba 2017-03-06 09:15:52 EST
origin PR: https://github.com/openshift/origin/pull/13246
Comment 2 Yan Du 2017-03-15 02:06:43 EDT
Test on latest OCP env V3.5.0.52 with the latest script in https://github.com/openshift/origin/pull/13246

Seem the -r option is still not working:

$ ./clear-route-status.sh -r router1
error: index is not defined
.status.ingress | map(.routerName != "router1") | index(false)
                                                  ^^^^^
1 compile error
Comment 3 Eric Paris 2017-03-17 13:22:03 EDT
https://github.com/openshift/origin/issues/13246
Comment 5 jtanenba 2017-04-05 15:08:20 EDT
I can't reproduce the error that you see with the clear route script could you be more specific?
Comment 7 jtanenba 2017-04-19 13:18:10 EDT
https://github.com/openshift/origin/pull/13678 removed the call to index could you retest?
Comment 8 Yan Du 2017-04-24 01:16:07 EDT
Retest with the script in https://github.com/openshift/origin/pull/13678, got below error:

[root@host-8-174-54 ~]# ./clear-route-status.sh -r router
error: syntax error, unexpected QQSTRING_START, expecting $end
."status"."ingress"|=map(select(.routerName != "router"))
 ^
1 compile error
Comment 10 Yan Du 2017-04-27 22:39:12 EDT
The script in https://github.com/openshift/origin/pull/13678 could not work normally and get the error as #comment 8
Comment 11 Ben Bennett 2017-04-28 08:48:57 EDT
@Yan Du: Can you run:  jq --version 

Thanks
Comment 12 Yan Du 2017-05-01 21:48:39 EDT
# jq --version
jq version 1.3
Comment 13 Yan Du 2017-05-01 22:15:24 EDT
After using jq 1.5 for test, the script could work well.

# ./clear-route-status.sh -r router
route status for route route1 set by router router cleared
route status for route route2 set by router router cleared
route status for route route3 set by router router cleared
route status for route route4 set by router router cleared
route status for route route5 set by router router cleared
route status for route docker-registry set by router router cleared
route status for route registry-console set by router router cleared
route status for route cakephp-mysql-example set by router router cleared
No routes found for namespace kube-system
No routes found for namespace logging
No routes found for namespace management-infra
No routes found for namespace openshift
No routes found for namespace openshift-infra
Comment 14 jtanenba 2017-05-08 13:26:51 EDT
yan since this past your test could you move this forward?
Comment 15 Yan Du 2017-05-09 01:20:56 EDT
@jtanenba
Sure, but could you please kindly move to bug status to ON_QA, then I could move it to verified.
Comment 16 Yan Du 2017-05-09 22:42:30 EDT
@jtanenba

One more question, do we need to mention that the script only works with version jq >= 1.4 in documentation warning message in script?
Comment 17 Ben Bennett 2017-05-11 13:24:27 EDT
How did you upgrade jq?  What version of RHEL did 1.3 ship with?
Comment 18 Yan Du 2017-05-11 22:20:22 EDT
I am using rhel 7.2, and I just upgrade jq by downloading a binary from https://stedolan.github.io/jq/download/
Comment 19 Meng Bo 2017-05-12 00:21:24 EDT
The jq package from epel-7 repo is version 1.5-1
And seems it is not available in rhel-7-server-rpms and rhel-7-server-extras-rpms
Comment 20 Yan Du 2017-05-12 03:17:56 EDT
The command with -r option actually need to be ran on master with cluster-admin, but actually there is no jq installed by default on master. So do we plan to have jq installed by default on master?
Comment 21 Ben Bennett 2017-05-15 09:48:59 EDT
Ok, given what Meng Bo and Yan Du have found (thank you both, by the way!) I think we need to amend the checks around https://github.com/JacobTanenbaum/origin/blob/eb5f10682ea72f54fec0b7714ede032d273f3182/images/router/clear-route-status.sh#L86 to check for a minimum version too... and we should state the version needed in the message that tells people what to install.
Comment 22 Ben Bennett 2017-05-15 09:55:10 EDT
Although, in the interests of not going mad doing version parsing, perhaps we ought to do feature detection and add a line like:
 echo '' | jq '."status"."ingress"|=map(select(.routerName != "test"))'

And make sure that $? is 0.  If not, then we can tell them they need at least version 1.4.
Comment 23 jtanenba 2017-05-15 14:00:06 EDT
Origin PR: https://github.com/openshift/origin/pull/14200
Comment 25 openshift-github-bot 2017-05-20 03:20:05 EDT
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/866f8bbfadc082a18e5a0d3bbe9dfd0e0c56bbe2
Change version check on jq in clear route status script

jq is required for the JSON processing required for clearing the route status. During QA
it was found that the version of jq has to be greater than 1.4. Expand the check on jq
for the capabilities needed and the message to include the version number

Bug 1429398
Comment 27 Yan Du 2017-06-01 05:02:00 EDT
Test on latest OCP-3.6 env 
openshift v3.6.86
kubernetes v1.6.1+5115d708d7

[root@ip-172-18-4-211 ~]# ./clear-route-status.sh -r router
Command line JSON processor 'jq' not found.
please install 'jq' version greater than 1.4 to use this script.

[root@ip-172-18-4-211 ~]# jq --version
jq version 1.3
[root@ip-172-18-4-211 ~]# ./clear-route-status.sh -r router
Command line JSON processor 'jq' version is incorrect.
Please install 'jq' version greater than 1.4 to use this script

[root@ip-172-18-4-211 ~]# jq --version
jq-1.5
[root@ip-172-18-4-211 ~]# ./clear-route-status.sh -r router
No routes found for namespace d1
No routes found for namespace d2
route status for route test-service set by router router cleared
route status for route docker-registry set by router router cleared
route status for route registry-console set by router router cleared
route status for route cakephp-mysql-example set by router router cleared
Comment 29 errata-xmlrpc 2017-08-10 01:18:47 EDT
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.