Commit d4ee919f authored by Stuart McLaren's avatar Stuart McLaren

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", ...}
parent 440d0862
......@@ -88,6 +88,9 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *co
// Complete completes all the required options
func (o *Options) Complete(f cmdutil.Factory, cmd *cobra.Command) error {
var err error
if o.ClientOnly {
return nil
}
o.discoveryClient, err = f.ToDiscoveryClient()
// 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment