mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
deprecate and disconnect --output-version
This commit is contained in:
@@ -78,14 +78,6 @@ func (f *ring1Factory) Object() (meta.RESTMapper, runtime.ObjectTyper) {
|
||||
mapper, err = NewShortcutExpander(mapper, discoveryClient)
|
||||
CheckErr(err)
|
||||
|
||||
// wrap with output preferences
|
||||
cfg, err := f.clientAccessFactory.ClientConfigForVersion(nil)
|
||||
checkErrWithPrefix("failed to get client config: ", err)
|
||||
cmdApiVersion := schema.GroupVersion{}
|
||||
if cfg.GroupVersion != nil {
|
||||
cmdApiVersion = *cfg.GroupVersion
|
||||
}
|
||||
mapper = kubectl.OutputVersionMapper{RESTMapper: mapper, OutputVersions: []schema.GroupVersion{cmdApiVersion}}
|
||||
return mapper, api.Scheme
|
||||
}
|
||||
|
||||
@@ -376,25 +368,15 @@ func (f *ring1Factory) PrinterForMapping(cmd *cobra.Command, mapping *meta.RESTM
|
||||
|
||||
// Make sure we output versioned data for generic printers
|
||||
if generic {
|
||||
clientConfig, err := f.clientAccessFactory.ClientConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
version, err := OutputVersion(cmd, clientConfig.GroupVersion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if version.Empty() && mapping != nil {
|
||||
version = mapping.GroupVersionKind.GroupVersion()
|
||||
if mapping == nil {
|
||||
return nil, fmt.Errorf("no serialization format found")
|
||||
}
|
||||
version := mapping.GroupVersionKind.GroupVersion()
|
||||
if version.Empty() {
|
||||
return nil, fmt.Errorf("you must specify an output-version when using this output format")
|
||||
return nil, fmt.Errorf("no serialization format found")
|
||||
}
|
||||
|
||||
if mapping != nil {
|
||||
printer = kubectl.NewVersionedPrinter(printer, mapping.ObjectConvertor, version, mapping.GroupVersionKind.GroupVersion())
|
||||
}
|
||||
printer = kubectl.NewVersionedPrinter(printer, mapping.ObjectConvertor, version, mapping.GroupVersionKind.GroupVersion())
|
||||
|
||||
} else {
|
||||
// Some callers do not have "label-columns" so we can't use the GetFlagStringSlice() helper
|
||||
|
||||
Reference in New Issue
Block a user