Bug 1567722 - Cronjobs can not be described in specific project
Summary: Cronjobs can not be described in specific project
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Master
Version: 3.10.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.10.0
Assignee: Jordan Liggitt
QA Contact: Wang Haoran
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-16 05:20 UTC by weiwei jiang
Modified: 2018-07-30 19:13 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Cronjobs only exist in some versions of the "batch" API group. "oc describe cronjob/..." was attempting to read cronjobs from an incorrect version. Consequence: "oc describe cronjob/..." would display an error Fix: Made "oc describe cronjob/..." fetch the cronjob from the correct API version Result: "oc describe cronjob/..." works properly
Clone Of:
Environment:
Last Closed: 2018-07-30 19:13:03 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:1816 None None None 2018-07-30 19:13:21 UTC

Description weiwei jiang 2018-04-16 05:20:55 UTC
Description of problem:
When I try with openshift-descheduler roles for openshift-ansible and found that cronjobs can not be described in openshift-descheduler project.

# for i in `oc get ns --no-headers| awk '{print $1}'`; do command="oc describe cronjobs"; echo "======= namespace: $(oc project $i -q) ==> command: ${command}"; eval ${command};ec[0/1130]rn code: $?"; done                                  
======= namespace: default ==> command: oc describe cronjobs                                             
return code: 0                                      
======= namespace: install-test ==> command: oc describe cronjobs                                        
return code: 0                                      
======= namespace: kube-public ==> command: oc describe cronjobs                                         
return code: 0                                      
======= namespace: kube-service-catalog ==> command: oc describe cronjobs                                
return code: 0                                      
======= namespace: kube-system ==> command: oc describe cronjobs                                         
return code: 0                                      
======= namespace: logging ==> command: oc describe cronjobs                                             
return code: 0                                      
======= namespace: management-infra ==> command: oc describe cronjobs                                    
return code: 0                                      
======= namespace: openshift ==> command: oc describe cronjobs                                           
return code: 0                                      
======= namespace: openshift-ansible-service-broker ==> command: oc describe cronjobs                    
return code: 0                                      
======= namespace: openshift-descheduler ==> command: oc describe cronjobs                               
Error from server (NotFound): the server could not find the requested resource                           
return code: 1                                      
======= namespace: openshift-infra ==> command: oc describe cronjobs                                     
return code: 0                                      
======= namespace: openshift-node ==> command: oc describe cronjobs                                      
return code: 0                                      
======= namespace: openshift-sdn ==> command: oc describe cronjobs                                       
return code: 0                                      
======= namespace: openshift-template-service-broker ==> command: oc describe cronjobs                   
return code: 0                                      
======= namespace: openshift-web-console ==> command: oc describe cronjobs                               
return code: 0                                      
======= namespace: wjiang ==> command: oc describe cronjobs                                              
return code: 0          

Version-Release number of selected component (if applicable):
# oc version                
oc v3.10.0-0.21.0
kubernetes v1.10.0+b81c8f8
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://ip-172-18-3-170.ec2.internal:8443
openshift v3.10.0-0.21.0
kubernetes v1.10.0+b81c8f8



How reproducible:
Always

Steps to Reproduce:
1. Setup OCP 3.10 env
2. Install openshift-descheduler with:
 ansible-playbook -vvv -i qe-inventory-host-file playbooks/openshift-descheduler/config.yml 
3. Check cronjebs if can be described in each project

Actual results:
cronjobs can not be described in openshift-descheduler project
# oc describe cronjobs -n openshift-descheduler --loglevel=8
I0416 01:15:48.676091   89411 loader.go:357] Config loaded from file /root/.kube/config
I0416 01:15:48.693932   89411 round_trippers.go:383] GET https://ip-172-18-3-170.ec2.internal:8443/apis/batch/v1beta1/namespaces/openshift-descheduler/cronjobs?includeUninitialized=true
I0416 01:15:48.693963   89411 round_trippers.go:390] Request Headers:
I0416 01:15:48.693973   89411 round_trippers.go:393]     Accept: application/json
I0416 01:15:48.693982   89411 round_trippers.go:393]     User-Agent: oc/v1.10.0+b81c8f8 (linux/amd64) kubernetes/b81c8f8
I0416 01:15:48.706838   89411 round_trippers.go:408] Response Status: 200 OK in 12 milliseconds
I0416 01:15:48.706895   89411 round_trippers.go:411] Response Headers:
I0416 01:15:48.706907   89411 round_trippers.go:414]     Content-Length: 1525
I0416 01:15:48.706922   89411 round_trippers.go:414]     Date: Mon, 16 Apr 2018 05:15:48 GMT
I0416 01:15:48.706931   89411 round_trippers.go:414]     Cache-Control: no-store
I0416 01:15:48.706945   89411 round_trippers.go:414]     Content-Type: application/json
I0416 01:15:48.706988   89411 request.go:874] Response Body: {"kind":"CronJobList","apiVersion":"batch/v1beta1","metadata":{"selfLink":"/apis/batch/v1beta1/namespaces/openshift-descheduler/cronjobs","resourceVersion":"20678"},"items":[{"metadata":{"name":"descheduler-cronjob","namespace":"openshift-descheduler","selfLink":"/apis/batch/v1beta1/namespaces/openshift-descheduler/cronjobs/descheduler-cronjob","uid":"6091d670-4125-11e8-93aa-0e4dd28477e6","resourceVersion":"6860","creationTimestamp":"2018-04-16T03:22:22Z"},"spec":{"schedule":"*/1 0 * * *","concurrencyPolicy":"Allow","suspend":false,"jobTemplate":{"metadata":{"creationTimestamp":null},"spec":{"template":{"metadata":{"name":"descheduler-cronjob","creationTimestamp":null},"spec":{"volumes":[{"name":"policy-volume","configMap":{"name":"descheduler-policy-configmap","defaultMode":420}}],"containers":[{"name":"descheduler","image":"registry.access.redhat.com/openshift3/ose-descheduler:v3.10.0","command":["/bin/descheduler"],"args":["--policy-config-file=/policy-dir/policy.yaml","--dry-run"],"resources":{},"volumeMo [truncated 501 chars]
I0416 01:15:48.708328   89411 round_trippers.go:383] GET https://ip-172-18-3-170.ec2.internal:8443/apis/batch/v1/namespaces/openshift-descheduler/cronjobs/descheduler-cronjob
I0416 01:15:48.708353   89411 round_trippers.go:390] Request Headers:
I0416 01:15:48.708363   89411 round_trippers.go:393]     User-Agent: oc/v1.10.0+b81c8f8 (linux/amd64) kubernetes/b81c8f8
I0416 01:15:48.708378   89411 round_trippers.go:393]     Accept: application/json, */*
I0416 01:15:48.709212   89411 round_trippers.go:408] Response Status: 404 Not Found in 0 milliseconds
I0416 01:15:48.709235   89411 round_trippers.go:411] Response Headers:
I0416 01:15:48.709253   89411 round_trippers.go:414]     Content-Type: application/json
I0416 01:15:48.709262   89411 round_trippers.go:414]     Content-Length: 174
I0416 01:15:48.709270   89411 round_trippers.go:414]     Date: Mon, 16 Apr 2018 05:15:48 GMT
I0416 01:15:48.709285   89411 round_trippers.go:414]     Cache-Control: no-store
I0416 01:15:48.709309   89411 request.go:874] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"the server could not find the requested resource","reason":"NotFound","details":{},"code":404}
I0416 01:15:48.709550   89411 helpers.go:201] server response object: [{
  "metadata": {},
  "status": "Failure",
  "message": "the server could not find the requested resource",
  "reason": "NotFound",
  "details": {},
  "code": 404
}]
F0416 01:15:48.709610   89411 helpers.go:119] Error from server (NotFound): the server could not find the requested resource


Expected results:
Cronjobs can be described in specific project

Additional info:

Comment 1 Jordan Liggitt 2018-04-17 17:50:56 UTC
describe cronjobs is simply broken. it produces errors in any namespace containing a cronjob.

the describer needs to change upstream to avoid using an internal client, since the preferred version for the batch api group does not contain the cronjobs resource

Comment 2 Jordan Liggitt 2018-04-17 18:53:24 UTC
Fix in https://github.com/openshift/origin/pull/19391

Comment 3 weiwei jiang 2018-04-26 07:08:13 UTC
Checked with 
# oc version 
oc v3.10.0-0.29.0
kubernetes v1.10.0+b81c8f8
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://ip-172-18-6-51.ec2.internal:8443
openshift v3.10.0-0.29.0
kubernetes v1.10.0+b81c8f8


And the issue can not be reproduced.

Comment 4 DeShuai Ma 2018-04-27 05:10:17 UTC
As comment 3 , move to verified.

Comment 6 errata-xmlrpc 2018-07-30 19:13:03 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/RHBA-2018:1816


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