kubernetes client-go依赖报错
初次使用kubenetes client-go来学习遇到的问题。
代码使用github 练习:examples/out-of-cluster-client-configuration/main.go
使用go build -o app . 出现以下错误
代码使用github 练习:examples/out-of-cluster-client-configuration/main.go
使用go build -o app . 出现以下错误
# k8s.io/client-go/tools/clientcmd/api/v1 D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:29:15: scheme.AddConversionFuncs undefined (type *runtime.Scheme has no field or method AddConversionFuncs) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:31:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:34:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:37:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:40:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:43:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:46:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:49:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) D:\software\gotest\pkg\mod\k8s.io\+incompatible\tools\clientcmd\api\v1\conversion.go:52:12: s.DefaultConvert undefined (type conversion.Scope has no field or method DefaultConvert) # k8s.io/client-go/rest D:\software\gotest\pkg\mod\k8s.io\+incompatible\rest\request.go:598:31: not enough arguments in call to watch.NewStreamWatcher
golang version:1.14
client-go version: 1.18
修改go.mod 文件,替换k8s.io\+incompatible为k8s.io/client-go v0.18.2,然后在go build就可以了,github issue中解释如下:
Related issue is that go get k8s.io/ resolves to v11.0.0+incompatible not v0.18.2. Should I break this off as a separate discussion? Unfortunately, that is not possible to resolve. k8s.io/client-go had major versions tagged prior to the introduction of go modules. go modules require any major version X >= 2 rename the module to k8s.io/client-go/v<X>. Go considers tags >= 2.x.x which contain a go.mod file with a module name that doesn‘t end with /v<X> invalid and won‘t include them when resolving @latest, so until the k8s.io/client-go module is renamed with version suffixes, go get must indicate specific versions (e.g. go get k8s.io/)
相关推荐
朱培知浅ZLH 2020-11-16
cdbdqn00 2020-11-12
达观数据 2020-11-11
JustinChia 2020-11-11
远远的山 2020-11-09
jingtao 2020-11-08
大叔比较胖 2020-10-30
gracecxj 2020-10-30
onepiecedn 2020-10-29
kunyus 2020-10-28
JustHaveTry 2020-10-27
锋锋 2020-10-26
hubanbei00的家园 2020-10-25
谢恩铭 2020-10-23
btqszl 2020-10-21
kaidiphp 2020-10-13
guchengxinfen 2020-10-12
liverlife 2020-10-10
BigDataMining 2020-10-08