cni 一些库

作者: admin 分类: 乱7八糟 发布时间: 2018-05-09 13:37 ė 6 没有评论

The Ratchet dependencies
Some of the most important dependencies are in these lines in ratchet.go, which includes:

github.com/containernetworking/cni/pkg/skel: Skeleton for CNI to read stdin & environment variables.
github.com/containernetworking/cni/pkg/invoke: Allows us to use the DelegateAdd method which we use to call other plugins.
github.com/containernetworking/cni/pkg/types: Some common types that are used by the CNI packages, including the NetConf type which defines our config JSON that we read from stdin.
There’s also a Docker client that we use to pick some additional metadata from the pod.

The main method
The main() method of the application is really just calling skel – as seen here, which looks like:

skel.PluginMain(cmdAdd, cmdDel)
So we let skel do some work for us – it will call either of these methods (which are local to the Ratchet application), either cmdAdd or cmdDel (called on either creation or deletion of the pod). In those methods – we’re able to have a return from skel that includes the JSON config, which we can then parse and read to get some custom properties out of it.

本文出自 小Q,转载时请注明出处及相应链接。

本文永久链接: http://www.linuxqq.com/archives/1830.html

0
更多
Ɣ回顶部