How to add new packages in Kubernetes

7/6/2017

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.

-- Jian Zhang
go
kubernetes

1 Answer

7/6/2017

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.

-- Jian Zhang
Source: StackOverflow