Bug 1487245

Summary: 'oc get' with 'projectrequest' output as yaml or json causes panic
Product: OpenShift Container Platform Reporter: David Caldwell <dcaldwel>
Component: ocAssignee: Juan Vallejo <jvallejo>
Status: CLOSED ERRATA QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: medium    
Version: 3.6.1CC: aos-bugs, ffranz, hasha, jokerman, jvallejo, mmccomas, spadgett
Target Milestone: ---   
Target Release: 3.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-28 22:08:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Caldwell 2017-08-31 13:39:21 UTC
Description of problem:
Executing 'oc get --all-namespaces --output=json projectrequests' causes panic. The combination of 'projectrequests' type and -o to yaml or json seems to cause the problem.

Version-Release number of selected component (if applicable):
3.5
3.6
(Customer logged bug with OCP 3.6.1 but I can reproduce using same command using OCP 3.5)

How reproducible:
Execute 'oc get --all-namespaces --output=json projectrequests' on the CLI 

Steps to Reproduce:
1. Log in to master
2. Execute 'oc get --all-namespaces --output=json projectrequests'
3. 

Actual results:
$ oc get --all-namespaces --output=json projectrequests
panic: interface conversion: runtime.Object is *unversioned.Status, not *runtime.Unstructured

goroutine 1 [running]:
panic(0x1fabce0, 0xc4209ac640)
	/usr/lib/golang/src/runtime/panic.go:500 +0x1a1
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd.RunGet(0x362aae0, 0xc420a385a0, 0x35fcd80, 0xc420026010, 0x35fcd80, 0xc420026018, 0xc4202f2b40, 0xc4206f3710, 0x1, 0x3, ...)
	/builddir/build/BUILD/atomic-openshift-git-0.b6f55a2/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get.go:341 +0xcda
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd.NewCmdGet.func1(0xc4202f2b40, 0xc4206f3710, 0x1, 0x3)
	/builddir/build/BUILD/atomic-openshift-git-0.b6f55a2/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get.go:105 +0x95
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).execute(0xc4202f2b40, 0xc4206f3680, 0x3, 0x3, 0xc4202f2b40, 0xc4206f3680)
	/builddir/build/BUILD/atomic-openshift-git-0.b6f55a2/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:603 +0x439
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc420314240, 0xc420026008, 0xc420026018, 0xc420314240)
	/builddir/build/BUILD/atomic-openshift-git-0.b6f55a2/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:689 +0x367
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).Execute(0xc420314240, 0x2, 0xc420314240)
	/builddir/build/BUILD/atomic-openshift-git-0.b6f55a2/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
	/builddir/build/BUILD/atomic-openshift-git-0.b6f55a2/_output/local/go/src/github.com/openshift/origin/cmd/oc/oc.go:36 +0x196

Expected results:
Don't panic

Additional info:

Comment 1 Juan Vallejo 2017-08-31 13:51:09 UTC
Related github issue: https://github.com/openshift/origin/issues/16064

Comment 2 Juan Vallejo 2017-08-31 18:38:19 UTC
Upstream PR: https://github.com/kubernetes/kubernetes/pull/51727

Comment 3 Juan Vallejo 2017-09-11 15:07:03 UTC
Origin PR (patch available in latest master): https://github.com/openshift/origin/pull/16082

Comment 4 shahan 2017-09-12 04:03:48 UTC
Checked this issue on oc v3.7.0-alpha.1+37bf502-282 version, it works well now.
[hasha@mypc origin]$ git log --pretty="%h %an %cd - %s"   37bf502  |   grep   '#16082'
4c6b2eb OpenShift Merge Robot Fri Sep 8 22:03:25 2017 -0700 - Merge pull request #16082 from juanvallejo/jvallejo/ensure-unstructured-objects-before-composing

[root@test ~]#oc get --all-namespaces --output=json projectrequests
{
    "apiVersion": "v1",
    "items": [
        {
            "apiVersion": "v1",
            "kind": "Status",
            "metadata": {},
            "status": "Success"
        }
    ],
    "kind": "List",
    "metadata": {
        "resourceVersion": "",
        "selfLink": ""
    }
}
Changed status to verified

Comment 11 errata-xmlrpc 2017-11-28 22:08:20 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/RHSA-2017:3188