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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user