Bug 1552325 - oc export daemonset no longer includes important information
Summary: oc export daemonset no longer includes important information
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.7.z
Assignee: Juan Vallejo
QA Contact: Xingxing Xia
URL:
Whiteboard:
: 1553696 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-06 23:00 UTC by Eric Jones
Modified: 2021-09-09 13:20 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: We switched to using unstructured objects for oc export in 3.7 as a way to avoid using hardcoded resource types in the client. Consequence: oc export fails for certain resources Fix: Add a fallback encoding to allow the command to behave correctly when dealing with these problematic resources. Result: oc export works just fine.
Clone Of:
Environment:
Last Closed: 2018-04-26 15:39:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Eric Jones 2018-03-06 23:00:21 UTC
Description of problem:
`oc export daemonset <DS_NAME>` and `oc get daemonset <DS_NAME> -o yaml` collects different data in ocp 3.7 compared to ocp 3.6

In 3.6, the only difference in the output from get and export is that get includes some additional metadata that export excludes.

In 3.7, there is a good bit of differences, most importantly the field "kind: DaemonSet" is missing in export.

Version-Release number of selected component (if applicable):
# oc version
oc v3.6.173.0.96
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://openshift.internal.36metricstest.quicklab.rdu2.cee.redhat.com:443
openshift v3.6.173.0.96
kubernetes v1.6.1+5115d708d7


Compared to:
# oc version
oc v3.7.23
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://openshift.internal.vault111.quicklab.rdu2.cee.redhat.com:443
openshift v3.7.23
kubernetes v1.7.6+a08f5eeb62



How reproducible:
100%

Steps to Reproduce:
1. Setup any daemonset
2. oc export ds <DS_NAME> | grep -i kind
3. oc get ds <DS_NAME> -o yaml | grep -i kind

Actual results:
in 3.7:
# oc export ds logging-fluentd | grep -i kind
# oc get -o yaml ds logging-fluentd | grep -i kind
kind: DaemonSet

in 3.6:
# oc export ds logging-fluentd | grep -i kind
kind: DaemonSet
# oc get -o yaml ds logging-fluentd | grep -i kind
kind: DaemonSet

Expected results:
# oc export ds logging-fluentd | grep -i kind
kind: DaemonSet
# oc get -o yaml ds logging-fluentd | grep -i kind
kind: DaemonSet

Comment 3 Michal Fojtik 2018-03-08 14:06:55 UTC
Agree with Maciej.

Comment 5 Juan Vallejo 2018-03-09 15:15:20 UTC
*** Bug 1553696 has been marked as a duplicate of this bug. ***

Comment 9 Xingxing Xia 2018-04-17 09:06:07 UTC
Checked in v3.7.44 env, oc export can work for ds, sts, deployment, hpa, etc, and the exported yaml files can work in `oc create -f`.
However, deployment has one problem (ds, sts, hpa don't have):
# oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/deployment/tc536600/hello-deployment-1.yaml
While `oc export deploy`, `oc export deploy hello-openshift`, `oc export deployment/hello-openshift` work, with slash it has problem:
# oc export deploy/hello-openshift
error: apps/v1beta1, Kind=Deployment is unstructured and is not suitable for converting to "extensions/v1beta1"

And with another flag --loglevel it can print yaml:
round_trippers.go:405] GET https://localhost:8443/apis/extensions/v1beta1/namespaces/xxia-proj-2/deployments/hello-openshift 200 OK in 8 milliseconds
I0417 05:03:20.100051   96586 exporter.go:249] No export strategy defined for objects of type *extensions.Deployment
I0417 05:03:20.101835   96586 result.go:260] info: the output version specified is invalid. Defaulting to "v1beta1"
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
...snipped..

Comment 10 Juan Vallejo 2018-04-17 20:54:11 UTC
I am unable to replicate the error seen in comment 9.
I am using the 3.7.44 version of the client, against a 3.7 master.

```
$ oc version
oc v3.7.44-1+6b061d4
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth

Server https://127.0.0.1:8443
openshift v3.7.0+7ed6862
kubernetes v1.7.6+a08f5eeb62
```

I am able to do `oc export deploy/hello-openshift`, `oc export deployment.extension/hello-openshift`, `oc export deploy hello-openshift`, `oc export deploy/hello-openshift`, etc. with no errors.

What version of the server are you running against?
Any chance you could provide access to a cluster that replicates the issue from comment 9? (or try with a newer / slightly older version of the client?)

Comment 16 Juan Vallejo 2018-04-26 15:40:30 UTC
A workaround for the deployments issue is to specify the group along with the resource kind:

```
$ oc export deploy.apps/hello-openshift
```


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