K8S+Cloud-Controller-Manager对接Openstack Cinder创建PV之一:编译cloud-provider-openstack

Jcinta ·
更新时间:2024-11-10
· 798 次阅读

1、编译环境

编译环境为ubuntu环境,可以连接外网

2、下载源代码 # mkdir /root/gopath/src/k8s.io # cd /root/gopath/src/k8s.io # git clone https://github.com/kubernetes/cloud-provider-openstack.git # git checkout -b remotes/origin/release-1.17 3、设置编译环境 3.1、安装go

参考:基于go编译环境编译virtual-kubelet用于kubernetes对接openstack-zun

3.2、设置编译环境变量 # export GOROOT=/opt/go # export PATH=$PATH:$GOROOT/bin # export GOPATH=~/gopath 4、编译 # cd cloud-provider-openstack # make build

编译好的版本就在当前目录下

~/gopath/src/k8s.io/cloud-provider-openstack# ls -l total 344952 -rwxr-xr-x 1 root root 30212096 Jan 16 10:21 barbican-kms-plugin -rw-r--r-- 1 root root 59 Jan 15 16:36 bindep.txt -rwxr-xr-x 1 root root 31297536 Jan 16 10:20 cinder-csi-plugin -rwxr-xr-x 1 root root 28225536 Jan 16 10:20 cinder-flex-volume-driver -rwxr-xr-x 1 root root 33583104 Jan 16 10:20 cinder-provisioner -rwxr-xr-x 1 root root 25587712 Jan 16 10:20 client-keystone-auth drwxr-xr-x 4 root root 4096 Jan 15 16:36 cluster drwxr-xr-x 14 root root 4096 Jan 15 16:36 cmd -rw-r--r-- 1 root root 148 Jan 15 16:36 code-of-conduct.md drwxr-xr-x 2 root root 4096 Jan 15 16:36 contrib -rw-r--r-- 1 root root 1757 Jan 15 16:36 CONTRIBUTING.md drwxr-xr-x 2 root root 4096 Jan 15 16:36 devstack drwxr-xr-x 2 root root 4096 Jan 15 16:36 docs drwxr-xr-x 11 root root 4096 Jan 15 16:36 examples -rw-r--r-- 1 root root 3599 Jan 15 16:43 go.mod -rw-r--r-- 1 root root 85769 Jan 15 16:36 go.sum drwxr-xr-x 2 root root 4096 Jan 15 16:36 hack -rwxr-xr-x 1 root root 29392896 Jan 16 10:20 k8s-keystone-auth -rw-r--r-- 1 root root 11358 Jan 15 16:36 LICENSE -rwxr-xr-x 1 root root 32014336 Jan 16 10:21 magnum-auto-healer -rw-r--r-- 1 root root 12686 Jan 15 16:36 Makefile drwxr-xr-x 11 root root 4096 Jan 15 16:36 manifests -rwxr-xr-x 1 root root 31285248 Jan 16 10:21 manila-csi-plugin -rwxr-xr-x 1 root root 35708928 Jan 16 10:20 manila-provisioner -rwxr-xr-x 1 root root 33312768 Jan 16 10:20 octavia-ingress-controller -rwxr-xr-x 1 root root 42409984 Jan 16 10:20 openstack-cloud-controller-manager -rw-r--r-- 1 root root 433 Jan 15 16:36 OWNERS drwxr-xr-x 15 root root 4096 Jan 15 16:36 pkg -rw-r--r-- 1 root root 1765 Jan 15 16:36 README.md -rw-r--r-- 1 root root 1567 Jan 15 16:36 release-procedure.md -rw-r--r-- 1 root root 540 Jan 15 16:36 SECURITY_CONTACTS -rw-r--r-- 1 root root 605 Jan 15 16:36 snapcraft.yaml drwxr-xr-x 2 root root 4096 Jan 15 16:36 test drwxr-xr-x 2 root root 4096 Jan 15 17:08 tmp drwxr-xr-x 2 root root 4096 Jan 15 16:36 tools 5、问题

编译过程中会出现如下问题:

build command-line-arguments: cannot load github.com/container-storage-interface/spec/lib/go/csi: github.com/container-storage-interface/spec@v1.2.0: Get https://proxy.golang.org/github.com/container-storage-interface/spec/@v/v1.2.0.zip: dial tcp 172.217.24.17:443: i/o timeout Makefile:60: recipe for target 'cinder-csi-plugin' failed make: *** [cinder-csi-plugin] Error 1 go: downloading github.com/gorilla/mux v1.7.3 build command-line-arguments: cannot load github.com/gorilla/mux: github.com/gorilla/mux@v1.7.3: Get https://proxy.golang.org/github.com/gorilla/mux/@v/v1.7.3.zip: dial tcp 172.217.27.145:443: i/o timeout Makefile:72: recipe for target 'k8s-keystone-auth' failed make: *** [k8s-keystone-auth] Error 1 go: downloading github.com/kubernetes-csi/csi-lib-utils v0.6.1 build command-line-arguments: cannot load github.com/kubernetes-csi/csi-lib-utils/connection: github.com/kubernetes-csi/csi-lib-utils@v0.6.1: Get https://proxy.golang.org/github.com/kubernetes-csi/csi-lib-utils/@v/v0.6.1.zip: dial tcp 172.217.24.17:443: i/o timeout Makefile:96: recipe for target 'manila-csi-plugin' failed make: *** [manila-csi-plugin] Error 1

这些问题的原因都一样,都是外部网络连接失败
dns每次解析的proxy.golang.org地址可能不同,有些地址能通,有些地址会超时,
多尝试几次能够编译通过


作者:vxlinux2019



manager pv openstack k8s

需要 登录 后方可回复, 如果你还没有账号请 注册新账号