mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Merge pull request #17316 from deads2k/gv-ClientForVersion
Auto commit by PR queue bot
This commit is contained in:
@@ -133,7 +133,10 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
|
||||
Object: func() (meta.RESTMapper, runtime.ObjectTyper) {
|
||||
cfg, err := clientConfig.ClientConfig()
|
||||
CheckErr(err)
|
||||
cmdApiVersion := cfg.Version
|
||||
cmdApiVersion := ""
|
||||
if cfg.GroupVersion != nil {
|
||||
cmdApiVersion = cfg.GroupVersion.String()
|
||||
}
|
||||
|
||||
return kubectl.OutputVersionMapper{RESTMapper: mapper, OutputVersion: cmdApiVersion}, api.Scheme
|
||||
},
|
||||
@@ -576,7 +579,10 @@ func (f *Factory) PrinterForMapping(cmd *cobra.Command, mapping *meta.RESTMappin
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defaultVersion := clientConfig.Version
|
||||
defaultVersion := ""
|
||||
if clientConfig.GroupVersion != nil {
|
||||
defaultVersion = clientConfig.GroupVersion.String()
|
||||
}
|
||||
|
||||
version := OutputVersion(cmd, defaultVersion)
|
||||
if len(version) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user