如何在Kubernetes中添加新软件包 [英] How to add new packages in Kubernetes

查看:413
本文介绍了如何在Kubernetes中添加新软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为标题,我在Kubernetes的 plugin / pkg / scheduler / algorithm / priorities 文件夹中添加了一个新的算法包。它是一个文件夹,有一些Go源文件,如 util 文件夹。但是,当运行 make 时,出现错误:

  test / e2e_node / e2e_node.test 
cmd / gke-certificates-controller
plugin / pkg / scheduler / algorithm / priorities / test.go:7:2:no buildable在/ home / zhangjian / src中找不到源文件/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities/test
!!! [0703 09:22:46]调用树:
!!! [0703 09:22:46] 1:/home/zhangjian/src/k8s.io/kubernetes/hack/lib/golang.sh:740 kube :: golang :: build_binaries_for_platform(...)
! ! [0703 09:22:46] 2:hack / make-rules / build.sh:27 kube :: golang :: build_binaries(...)
!!! [0703 09:22:46]调用树:
!!! [0703 09:22:46] 1:hack / make-rules / build.sh:27 kube :: golang :: build_binaries(...)
!!! [0703 09:22:46]调用树:
!!! [0703 09:22:46] 1:hack / make-rules / build.sh:27 kube :: golang :: build_binaries(...)
make:*** [all]错误1

他们确实是Go文件,我不知道错误的原因。或者我错过了什么?



我只想添加我自己的算法包(不是第三个库,例如 exapmle.com/xxx/ xxx )转换为优先级,那么步骤是怎样的?

我提到< a href =https://github.com/kubernetes/community/blob/master/contributors/devel/godep.md =nofollow noreferrer> community / contributors / devel / godep.md 并尝试过 go build ./... ./ hack / godep-restore.sh ./hack/godep-save.sh 命令,但仍然无效。

问题原来是由 CGO_ENABLED 变量引起的,仍然需要在 hack / lib / golang.sh 文件(kubernetes项目文件),尽管您在环境变量中启用了它。


As the title, I added a new algorithm package in the plugin/pkg/scheduler/algorithm/priorities folder for Kubernetes. It is a folder, there are some Go source files, like the util folder. But, when run make, I got the errors:

test/e2e_node/e2e_node.test
    cmd/gke-certificates-controller
plugin/pkg/scheduler/algorithm/priorities/test.go:7:2: no buildable Go source files in /home/zhangjian/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities/test
!!! [0703 09:22:46] Call tree:
!!! [0703 09:22:46]  1: /home/zhangjian/src/k8s.io/kubernetes/hack/lib/golang.sh:740 kube::golang::build_binaries_for_platform(...)
!!! [0703 09:22:46]  2: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0703 09:22:46] Call tree:
!!! [0703 09:22:46]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0703 09:22:46] Call tree:
!!! [0703 09:22:46]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make: *** [all] Error 1

They are the Go files indeed, I didn't know the reason of the error. Or something else I missed?

And I just want to add my own algorithm package (not the third libs, such exapmle.com/xxx/xxx) into the priority, so what's the steps?

I referred to community/contributors/devel/godep.md and tried go build ./..., ./hack/godep-restore.sh, ./hack/godep-save.sh commands, but still did not work.

解决方案

The problem turned out to be caused by CGO_ENABLED variable, still need to set it enable in hack/lib/golang.sh file (a file of kubernetes project) although you enabled it in environment variable.

这篇关于如何在Kubernetes中添加新软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆