mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
The versioned printer should be initialized with the mapping apiversion
VersionedPrinter handles fallback when multiple different APIVersions are present if multiple arguments are passed (for instance, both Kube resources at v1beta3 and a third party's API objects which are only at v1). The cmd PrinterForMapping should always include the current object's "mapping version" as a fallback in the event the preferred API version does not map to the actual object.
This commit is contained in:
parent
2215a64567
commit
92a68ad7bf
@ -373,7 +373,7 @@ func (f *Factory) PrinterForMapping(cmd *cobra.Command, mapping *meta.RESTMappin
|
||||
if len(version) == 0 {
|
||||
return nil, fmt.Errorf("you must specify an output-version when using this output format")
|
||||
}
|
||||
printer = kubectl.NewVersionedPrinter(printer, mapping.ObjectConvertor, version)
|
||||
printer = kubectl.NewVersionedPrinter(printer, mapping.ObjectConvertor, version, mapping.APIVersion)
|
||||
} else {
|
||||
printer, err = f.Printer(mapping, GetFlagBool(cmd, "no-headers"))
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user