Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b082eced13 | ||
|
|
10cf53cc9c | ||
|
|
c193fbe3c0 |
@@ -351,10 +351,6 @@ func (p *ACIProvider) setupNetworkProfile(auth *client.Authentication) error {
|
|||||||
return fmt.Errorf("unable to delegate subnet '%s' to Azure Container Instance as it is used by other Azure resource: '%v'.", p.subnetName, l)
|
return fmt.Errorf("unable to delegate subnet '%s' to Azure Container Instance as it is used by other Azure resource: '%v'.", p.subnetName, l)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if subnet.SubnetPropertiesFormat.IPConfigurationProfiles != nil && len(*subnet.SubnetPropertiesFormat.IPConfigurationProfiles) != 0 {
|
|
||||||
return fmt.Errorf("unable to delegate subnet '%s' to Azure Container Instance as its IP configuration profiles is not empty.", p.subnetName)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, d := range *subnet.SubnetPropertiesFormat.Delegations {
|
for _, d := range *subnet.SubnetPropertiesFormat.Delegations {
|
||||||
if d.ServiceDelegationPropertiesFormat != nil && *d.ServiceDelegationPropertiesFormat.ServiceName == subnetDelegationService {
|
if d.ServiceDelegationPropertiesFormat != nil && *d.ServiceDelegationPropertiesFormat.ServiceName == subnetDelegationService {
|
||||||
createSubnet = false
|
createSubnet = false
|
||||||
@@ -372,7 +368,9 @@ func (p *ACIProvider) setupNetworkProfile(auth *client.Authentication) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
profile, err := c.GetProfile(p.resourceGroup, p.nodeName)
|
networkProfileName := getNetworkProfileName(*subnet.ID)
|
||||||
|
|
||||||
|
profile, err := c.GetProfile(p.resourceGroup, networkProfileName)
|
||||||
if err != nil && !network.IsNotFound(err) {
|
if err != nil && !network.IsNotFound(err) {
|
||||||
return fmt.Errorf("error while looking up network profile: %v", err)
|
return fmt.Errorf("error while looking up network profile: %v", err)
|
||||||
}
|
}
|
||||||
@@ -388,7 +386,7 @@ func (p *ACIProvider) setupNetworkProfile(auth *client.Authentication) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// at this point, profile should be nil
|
// at this point, profile should be nil
|
||||||
profile = network.NewNetworkProfile(p.nodeName, p.region, *subnet.ID)
|
profile = network.NewNetworkProfile(networkProfileName, p.region, *subnet.ID)
|
||||||
profile, err = c.CreateOrUpdateProfile(p.resourceGroup, profile)
|
profile, err = c.CreateOrUpdateProfile(p.resourceGroup, profile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -398,6 +396,13 @@ func (p *ACIProvider) setupNetworkProfile(auth *client.Authentication) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getNetworkProfileName(subnetID string) string {
|
||||||
|
h := sha256.New()
|
||||||
|
h.Write([]byte(strings.ToUpper(subnetID)))
|
||||||
|
hashBytes := h.Sum(nil)
|
||||||
|
return fmt.Sprintf("vk-%s", hex.EncodeToString(hashBytes))
|
||||||
|
}
|
||||||
|
|
||||||
func getKubeProxyExtension(secretPath, masterURI, clusterCIDR string) (*aci.Extension, error) {
|
func getKubeProxyExtension(secretPath, masterURI, clusterCIDR string) (*aci.Extension, error) {
|
||||||
ca, err := ioutil.ReadFile(secretPath + "/ca.crt")
|
ca, err := ioutil.ReadFile(secretPath + "/ca.crt")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user