Add API client for Azure custom vnet (#271)

* Update vendor for azure vent support

* Add support for Azure custom vnets.

Use pointers intead of values. This allows the client to pass back
returned data from Azure.
This commit is contained in:
Brian Goff
2018-07-25 16:49:39 -07:00
committed by Robbie Zhang
parent 36eb3db8a9
commit 25e454d18f
56 changed files with 36373 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package azure
import (
"fmt"
"io"
"net"
"strings"
"github.com/BurntSushi/toml"
@@ -16,6 +17,8 @@ type providerConfig struct {
CPU string
Memory string
Pods string
SubnetName string
SubnetCIDR string
}
func (p *ACIProvider) loadConfig(r io.Reader) error {
@@ -53,6 +56,19 @@ func (p *ACIProvider) loadConfig(r io.Reader) error {
}
}
// default subnet name
if config.SubnetName != "" {
p.subnetName = config.SubnetName
}
if config.SubnetCIDR != "" {
if config.SubnetName == "" {
return fmt.Errorf("subnet CIDR is set but no subnet name provided, must provide a subnet name in order to set a subnet CIDR")
}
if _, _, err := net.ParseCIDR(config.SubnetCIDR); err != nil {
return fmt.Errorf("error parsing provided subnet CIDR: %v", err)
}
}
p.operatingSystem = config.OperatingSystem
return nil
}