hi,forums
when i run go install in cmd/kube-apiserver, then start this binary, the service always failed with
panic(0x305bb20, 0xc8203cb430)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
flag.(_FlagSet).Var(0xc820088300, 0x7f9dde6366a0, 0xc8203cb3e0, 0x42546b0, 0x7, 0x4714660, 0x2f)
/usr/local/go/src/flag/flag.go:776 +0x454
flag.(_FlagSet).StringVar(0xc820088300, 0xc8203cb3e0, 0x42546b0, 0x7, 0x0, 0x0, 0x4714660, 0x2f)
/usr/local/go/src/flag/flag.go:679 +0xc7
flag.(*FlagSet).String(0xc820088300, 0x42546b0, 0x7, 0x0, 0x0, 0x4714660, 0x2f, 0xc8203cb3d0)
/usr/local/go/src/flag/flag.go:692 +0x83
flag.String(0x42546b0, 0x7, 0x0, 0x0, 0x4714660, 0x2f, 0x7f9dde5b4d00)
/usr/local/go/src/flag/flag.go:699 +0x5f
github.com/golang/glog.init()
/opt/k8s/src/github.com/golang/glog/glog_file.go:41 +0x13e
k8s.io/client-go/1.4/pkg/labels.init()
/opt/k8s/src/k8s.io/client-go/1.4/pkg/labels/selector.go:822 +0x5b
k8s.io/client-go/1.4/pkg/api/unversioned.init()
/opt/k8s/src/k8s.io/client-go/1.4/pkg/api/unversioned/zz_generated.deepcopy.go:390 +0x6f
k8s.io/client-go/1.4/pkg/api.init()
/opt/k8s/src/k8s.io/client-go/1.4/pkg/api/zz_generated.deepcopy.go:3749 +0x6e
k8s.io/client-go/1.4/rest.init()
/opt/k8s/src/k8s.io/client-go/1.4/rest/versions.go:88 +0x75
k8s.io/kubernetes/plugin/pkg/client/auth/gcp.init()
/opt/k8s/src/k8s.io/kubernetes/plugin/pkg/client/auth/gcp/gcp.go:119 +0x59
k8s.io/kubernetes/plugin/pkg/client/auth.init()
/opt/k8s/src/k8s.io/kubernetes/plugin/pkg/client/auth/plugins.go:23 +0x3b
k8s.io/kubernetes/pkg/client/unversioned.init()
/opt/k8s/src/k8s.io/kubernetes/pkg/client/unversioned/util.go:79 +0xe7
k8s.io/kubernetes/pkg/controller/serviceaccount.init()
/opt/k8s/src/k8s.io/kubernetes/pkg/controller/serviceaccount/tokens_controller.go:746 +0xa8
k8s.io/kubernetes/cmd/kube-apiserver/app.init()
/opt/k8s/src/k8s.io/kubernetes/cmd/kube-apiserver/app/server.go:310 +0x107
main.init()
/opt/k8s/src/k8s.io/kubernetes/cmd/kube-apiserver/apiserver.go:54 +0x4f
even doing the steps below:
1)run godep restore (godep) in the client-go/1.4 folder, then remove the vendor folder of client-go. Then the packages in your GOPATH will be the only copy
2)or run godep save in your application folder to flatten all dependencies.
the problems can not be resolved, how can i do to solve this, thks.
@vklonghml maybe this is not directly related to your problem, but why would k8s.io/kubernetes/cmd/kube-apiserver/apiserver.go ended up calling client-go?
I'm willing to guess that your vendor folder contains two glogs and this is causing the redefinition error i.e.
vendor/github.com/golang/glog
vendor/k8s.io/client-go/vendor/github.com/golang/glog
One quick solution might be to delete the vendor/k8s.io/client-go/vendor/github.com/golang/glog one, rebuild, and try running it again.
Yesterday I hit the same issue with error messages like "flag redefined: log_dir", which was not exactly easy to address.
When a go application depends on client-go, developer should either manually clean up duplicated vendors locally, (like above) or make it selectively vendor k8s.io/client-go. Obviously the latter is a better choice in practice.
In the long term, I think client-go should not include own vendor directories on its own, like being discussed in https://github.com/kubernetes/client-go/issues/83.
@dongsupark if client-go doesn't include vendor/, go get users will have a hard time. go get will download from the master branches of the dependent repos, which may not compile with client-go. We need to make trade-off, let's discuss on #83.
Most helpful comment
I'm willing to guess that your vendor folder contains two glogs and this is causing the redefinition error i.e.
One quick solution might be to delete the
vendor/k8s.io/client-go/vendor/github.com/golang/glogone, rebuild, and try running it again.