vmware-archive / kubecfg

A tool for managing complex enterprise Kubernetes environments as code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kubecfg should be more robust against bad server Major/Minor info

jdxyw opened this issue · comments

commented

hi all

step 1, install the minikube and start
step 2. download the release binary
step 3. using the configuration under example and run kubecfg create, it'ok
step 4 trying to delete by running kubecfg delete, it failed like below

get error like below
ERROR strconv.Atoi: parsing "": invalid syntax

~/dev/kubecfg$ kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.4", GitCommit:"793658f2d7ca7f064d2bdf606519f9fe1229c381", GitTreeState:"clean", BuildDate:"2017-08-17T17:03:51Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"", Minor:"", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2018-01-26T19:04:38Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
 :~/dev/kubecfg$ ./kubecfg version
kubecfg version: v0.7.2
jsonnet version: v0.9.5
client-go version: v1.7.3-beta.0+$Format:%h$
(py36) yongweixing@ :~/dev/kubecfg$ ./kubecfg version
kubecfg version: v0.7.2
jsonnet version: v0.9.5
client-go version: v1.7.3-beta.0+$Format:%h$
 :~/dev/kubecfg$ minikube version
minikube version: v0.25.0

Thanks for the report. This is a known and unfortunate minikube bug (kubernetes/minikube#2505). You can see it was compiled without setting the server Major/Minor versions correctly at apiserver build time (they're both "").

My local minikube seems to have this fixed, but I don't remember if I had to do something to make that happen:

$ minikube version
minikube version: v0.25.0
$ kubectl --context minikube version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.4", GitCommit:"bee2d1505c4fe820744d26d41ecd3fdd4a3d6546", GitTreeState:"clean", BuildDate:"2018-03-12T16:29:47Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T20:55:30Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}

I'm leaving this open as a kubecfg bug, because we should also handle this better. Either make it non-fatal (log a warning and make a wild guess at server version/behaviour), or at least improve the error message to make it clear what's going on.

@anguslees Kubernetes is recommending to parse Gitversion, instead of Major, Minor. Shall we do that in Kubecfg? https://github.com/kubernetes/kubernetes/blob/v1.9.3/pkg/version/base.go#L37-L41