Bug 1921281 - oc get -o yaml --export returns "error: unknown flag: --export"
Summary: oc get -o yaml --export returns "error: unknown flag: --export"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.6.z
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: 4.7.0
Assignee: Maciej Szulik
QA Contact: RamaKasturi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-27 20:25 UTC by Tony Garcia
Modified: 2021-02-24 15:56 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-24 15:56:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift openshift-docs pull 28943 0 None closed Bug 1921281: remove --export flag from oc 2021-02-11 13:46:15 UTC
Red Hat Product Errata RHSA-2020:5633 0 None None None 2021-02-24 15:56:58 UTC

Description Tony Garcia 2021-01-27 20:25:58 UTC
Document URL: https://docs.openshift.com/container-platform/4.6/openshift_images/using-templates.html#templates-create-from-existing-object_using-templates

Section Number and Name: Creating a template from existing objects

Describe the issue: 
Customer is attempting to backup projects/namespaces by using the --export flag. This was possible in 3.x. When executing this in 4.6, we receive the following error:
oc get -o yaml --export all > cluster.yml
Error: unknown flag: --export
See 'oc get --help' for usage.

Is there a better way to export projects/namespaces other then exporting existing data into templates?

For example:
oc get -o yaml secrets -n <namespace> --template= > secrets.yml
oc get -o yaml configmap -n <namespace> --template= > cm.yml
oc create -f secrets.yml (in new cluster env)
oc create -f cm.yml (in new cluster env)

Suggestions for improvement:

Additional information: 
oc version
Client Version: 4.6.1
Server Version: 4.6.12
Kubernetes Version: v1.19.0+9c69bdc

Comment 1 Maciej Szulik 2021-01-28 09:58:32 UTC
(In reply to Tony Garcia from comment #0)
> Document URL:
> https://docs.openshift.com/container-platform/4.6/openshift_images/using-
> templates.html#templates-create-from-existing-object_using-templates

Apologies, the document is wrong, --export was removed in 4.6 I've opened a PR 
https://github.com/openshift/openshift-docs/pull/28907 to update our docs accordingly. 


> Describe the issue: 
> Customer is attempting to backup projects/namespaces by using the --export
> flag. This was possible in 3.x. When executing this in 4.6, we receive the
> following error:
> oc get -o yaml --export all > cluster.yml
> Error: unknown flag: --export
> See 'oc get --help' for usage.
> 
> Is there a better way to export projects/namespaces other then exporting
> existing data into templates?
> 
> For example:
> oc get -o yaml secrets -n <namespace> --template= > secrets.yml
> oc get -o yaml configmap -n <namespace> --template= > cm.yml
> oc create -f secrets.yml (in new cluster env)
> oc create -f cm.yml (in new cluster env)

There is no automated way transcoding resources from server to templates,
although I assume it's doable. The reason we've removed --export flag
is that the requirements of different parties were quite disconnected
and it wasn't possible to have a common agreement about its implementation.
That's why the suggested way is to retrieve objects and transform as
desired.

Comment 3 RamaKasturi 2021-02-04 16:00:26 UTC
As per discussion in the bug comments & also with dev i see that there is nothing that needs to be verified from code side and the verification lies in the documentation PR linked here. Looked at the doc PR and i see that command oc get -o yaml --export all > <yaml_filename> has been replaced with oc get -o yaml all > <yaml_filename>. Also "The object types included in oc get --export all are" has been replaced with "The object types included in oc get -o yaml all are:" in 4.7 & 4.6 documentation.

Based on the above moving the bug to verified state.

Comment 6 errata-xmlrpc 2021-02-24 15:56:44 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 (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), 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-2020:5633


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