-
Notifications
You must be signed in to change notification settings - Fork 115
Conversation
Signed-off-by: Yao Zengzeng <yaozengzeng@zju.edu.cn>
Signed-off-by: Yao Zengzeng <yaozengzeng@zju.edu.cn>
Seems vendor dose not updated properly? @YaoZengzeng |
return nil, nil, err | ||
} | ||
|
||
return &Runtime{client: hyperClient, streamingServer: streamingServer, networkPlugin: networkPlugin}, streamingServer, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: lines too long, consider format codes
const ( | ||
DefaultInterfaceName = "eth0" | ||
DefaultNetDir = "/etc/cni/net.d" | ||
DefaultCNIDir = "/opt/cni/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make these two path configurable?
func InitCNI() (*CNINetworkPlugin, error) { | ||
plugin := &CNINetworkPlugin{} | ||
|
||
plugin.sandboxNs = make(map[string]*sandboxNetNS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read and check network config here? So we could fail fast and don't need to read and check again and again later.
} | ||
|
||
rt := &libcni.RuntimeConf{ | ||
ContainerID: "cni", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sandboxID here?
} | ||
|
||
for _, link := range links { | ||
if link.Type() != "veth" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to support other interface types, it's better to omit only lo
here, e.g. interface name == lo
} | ||
|
||
type sandboxNetNS struct { | ||
netns ns.NetNS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to persist sandbox netns, e.g. in pod labels or write to local files.
@@ -118,6 +156,11 @@ func (h *Runtime) DeletePodSandbox(podSandboxID string) error { | |||
return err | |||
} | |||
|
|||
err = h.networkPlugin.TeardownPodNetwork(podSandboxID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
network should also be cleared up in StopPodSandbox
Cni network plugin for frakti