【问题标题】:How to add new packages in Kubernetes如何在 Kubernetes 中添加新包
【发布时间】:2017-12-10 04:07:08
【问题描述】:

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

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

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

而我只是想在priority中加入我自己的算法包(不是第三个库,比如exapmle.com/xxx/xxx),那么步骤是什么?

我参考了community/contributors/devel/godep.md并尝试了go build ./..../hack/godep-restore.sh./hack/godep-save.sh命令,但还是不行。

【问题讨论】:

    标签: go kubernetes


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-29
      • 1970-01-01
      • 1970-01-01
      • 2010-12-11
      • 2020-02-21
      • 2020-11-19
      • 2022-10-23
      相关资源
      最近更新 更多