agent/ecscni/plugin.go
func (client *cniClient) createIPAMNetworkConfig(cfg *Config) (string, *libcni.NetworkConfig, error) {
	ipamConfig, err := client.createIPAMConfig(cfg)
	if err != nil {
		return defaultVethName, nil, errors.Wrap(err, "createIPAMNetworkConfig: create ipam network configuration failed")
	}

	ipamNetworkConfig := IPAMNetworkConfig{
		Name:       ECSIPAMPluginName,
		CNIVersion: client.cniVersion,
		IPAM:       ipamConfig,
	}

	networkConfig, err := client.constructNetworkConfig(ipamNetworkConfig, ECSIPAMPluginName)
	if err != nil {
		return "", nil, errors.Wrap(err, "createIPAMNetworkConfig: construct ipam network configuration failed")
	}
	return defaultVethName, networkConfig, nil
}
func (client *cniClient) createIPAMNetworkConfig(cfg *Config) (string, *libcni.NetworkConfig, error) {
	ipamConfig, err := client.createIPAMConfig(cfg)
	if err != nil {
		return defaultVethName, nil, errors.Wrap(err, "createIPAMNetworkConfig: create ipam network configuration failed")
	}

	ipamNetworkConfig := IPAMNetworkConfig{
		Name:       ECSIPAMPluginName,
		CNIVersion: client.cniVersion,
		IPAM:       ipamConfig,
	}

	networkConfig, err := client.constructNetworkConfig(ipamNetworkConfig, ECSIPAMPluginName)
	if err != nil {
		return "", nil, errors.Wrap(err, "createIPAMNetworkConfig: construct ipam network configuration failed")
	}
	return defaultVethName, networkConfig, nil
}
func ( client * cniClient ) createIPAMNetworkConfig ( cfg * Config ) ( string , * libcni . NetworkConfig , error ) { ipamConfig , err := client . createIPAMConfig ( cfg ) if err != nil { return defaultVethName , nil , errors . Wrap ( err , " " ) } ipamNetworkConfig := IPAMNetworkConfig { Name : ECSIPAMPluginName , CNIVersion : client . cniVersion , IPAM : ipamConfig , } networkConfig , err := client . constructNetworkConfig ( ipamNetworkConfig , ECSIPAMPluginName ) if err != nil { return " " , nil , errors . Wrap ( err , " " ) } return defaultVethName , networkConfig , nil }
// createIPAMNetworkConfig constructs the ipam configuration accepted by libcni
createIPAMNetworkConfig constructs the ipam configuration accepted by libcni