Incorporate Casey's comments

This commit is contained in:
Tomofumi Hayashi
2018-07-26 21:29:43 +09:00
parent 3b3622db67
commit cc3ad26691

View File

@ -30,12 +30,9 @@ import (
// The top-level network config - IPAM plugins are passed the full configuration // The top-level network config - IPAM plugins are passed the full configuration
// of the calling plugin, not just the IPAM section. // of the calling plugin, not just the IPAM section.
type Net struct { type Net struct {
Name string `json:"name"` Name string `json:"name"`
CNIVersion string `json:"cniVersion"` CNIVersion string `json:"cniVersion"`
IPAM *IPAMConfig `json:"ipam"` IPAM *IPAMConfig `json:"ipam"`
RuntimeConfig struct {
Addresses []Address `json:"addresses,omitempty"`
} `json:"runtimeConfig,omitempty"`
} }
type IPAMConfig struct { type IPAMConfig struct {
@ -87,10 +84,6 @@ func LoadIPAMConfig(bytes []byte, envArgs string) (*IPAMConfig, string, error) {
return nil, "", fmt.Errorf("IPAM config missing 'ipam' key") return nil, "", fmt.Errorf("IPAM config missing 'ipam' key")
} }
if len(n.RuntimeConfig.Addresses) != 0 {
n.IPAM.Addresses = append(n.RuntimeConfig.Addresses, n.IPAM.Addresses...)
}
// Validate all ranges // Validate all ranges
numV4 := 0 numV4 := 0
numV6 := 0 numV6 := 0