diff --git a/pkg/oc/cli/cmd/export.go b/pkg/oc/cli/cmd/export.go index 19757a720e0e..aeca85f7ecef 100644 --- a/pkg/oc/cli/cmd/export.go +++ b/pkg/oc/cli/cmd/export.go @@ -142,6 +142,19 @@ func RunExport(f *clientcmd.Factory, exporter Exporter, in io.Reader, out io.Wri newInfos := []*resource.Info{} errs := []error{} for _, info := range infos { + // convert unstructured object to runtime.Object + data, err := runtime.Encode(kapi.Codecs.LegacyCodec(), info.Object) + if err != nil { + errs = append(errs, err) + continue + } + decoded, err := runtime.Decode(kapi.Codecs.UniversalDecoder(), data) + if err == nil { + // ignore error, if any, in order to allow resources + // not known by the client to still be exported + info.Object = decoded + } + if err := exporter.Export(info.Object, exact); err != nil { if err == ErrExportOmit { continue