api,libcni: add network config list-based plugin chaining
Using a new ".configlist" file format that allows specifying a list of CNI network configurations to run, add new libcni helper functions to call each plugin in the list, injecting the overall name, CNI version, and previous plugin's Result structure into the configuration of the next plugin.
This commit is contained in:
parent
06fd1369aa
commit
13534e505c
@ -59,14 +59,23 @@ func (n *IPNet) UnmarshalJSON(data []byte) error {
|
|||||||
type NetConf struct {
|
type NetConf struct {
|
||||||
CNIVersion string `json:"cniVersion,omitempty"`
|
CNIVersion string `json:"cniVersion,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
IPAM struct {
|
PrevResult *Result `json:"prevResult,omitempty"`
|
||||||
|
IPAM struct {
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
} `json:"ipam,omitempty"`
|
} `json:"ipam,omitempty"`
|
||||||
DNS DNS `json:"dns"`
|
DNS DNS `json:"dns"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetConfList describes an ordered list of networks.
|
||||||
|
type NetConfList struct {
|
||||||
|
CNIVersion string `json:"cniVersion,omitempty"`
|
||||||
|
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Plugins []*NetConf `json:"plugins,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// Result is what gets returned from the plugin (via stdout) to the caller
|
// Result is what gets returned from the plugin (via stdout) to the caller
|
||||||
type Result struct {
|
type Result struct {
|
||||||
IP4 *IPConfig `json:"ip4,omitempty"`
|
IP4 *IPConfig `json:"ip4,omitempty"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user