mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Fix kubectl version --client=true
Getting the client version fails if the kubeconfig is invalid: $ kubectl version --client=true Error in configuration: * unable to read client-cert .../client.crt: no such file or directory * unable to read client-key .../client.key: no such file or directory * unable to read certificate-authority .../ca.crt: no such file or directory Update to match behaviour on v1.10.13 and earlier: $ kubectl version --client=true Client Version: version.Info{Major:"1", ...}
This commit is contained in:
parent
440d086268
commit
d4ee919fb5
@ -88,6 +88,9 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *co
|
|||||||
// Complete completes all the required options
|
// Complete completes all the required options
|
||||||
func (o *Options) Complete(f cmdutil.Factory, cmd *cobra.Command) error {
|
func (o *Options) Complete(f cmdutil.Factory, cmd *cobra.Command) error {
|
||||||
var err error
|
var err error
|
||||||
|
if o.ClientOnly {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
o.discoveryClient, err = f.ToDiscoveryClient()
|
o.discoveryClient, err = f.ToDiscoveryClient()
|
||||||
// if we had an empty rest.Config, continue and just print out client information.
|
// if we had an empty rest.Config, continue and just print out client information.
|
||||||
// if we had an error other than being unable to build a rest.Config, fail.
|
// if we had an error other than being unable to build a rest.Config, fail.
|
||||||
|
Loading…
Reference in New Issue
Block a user