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
(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.
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.
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