编译k8s
代码时,会在k8s
根目录下生成一个_output
文件夹,同时这个文件夹下还包含local
文件夹:
~/kubernetes/_output/local$ ls
bin go
go
文件夹下就是一个标准的Go
语言workspace
:
:~/kubernetes/_output/local/go$ ls -alt
total 20
drwxrwxr-x 4 nan nan 4096 Dec 9 22:09 ..
drwxrwxr-x 2 nan nan 4096 Dec 9 22:09 bin
drwxrwxr-x 4 nan nan 4096 Dec 9 22:08 pkg
drwxrwxr-x 5 nan nan 4096 Dec 9 22:07 .
drwxrwxr-x 3 nan nan 4096 Dec 9 22:04 src
进入src
文件夹:
~/kubernetes/_output/local/go/src$ ls -alt
total 12
drwxrwxr-x 5 nan nan 4096 Dec 9 22:07 ..
drwxrwxr-x 2 nan nan 4096 Dec 9 22:06 k8s.io
drwxrwxr-x 3 nan nan 4096 Dec 9 22:04 .
nan@ubuntu:~/kubernetes/_output/local/go/src$ cd k8s.io/
nan@ubuntu:~/kubernetes/_output/local/go/src/k8s.io$ ls -alt
total 8
drwxrwxr-x 2 nan nan 4096 Dec 9 22:06 .
lrwxrwxrwx 1 nan nan 20 Dec 9 22:06 kubernetes -> /home/nan/kubernetes
drwxrwxr-x 3 nan nan 4096 Dec 9 22:04 ..
可以看到,src/k8s.io/kubernetes
就是一个指向外层工作目录的软链接。
至此,可以理解代码里下面import
语句为什么能工作了:
import (
"k8s.io/kubernetes/contrib/mesos/pkg/controllermanager"
"k8s.io/kubernetes/contrib/mesos/pkg/hyperkube"
)
有疑问加站长微信联系(非本文作者)