Update azure cloud provider for new azure SDK

This commit is contained in:
Brendan Burns 2016-12-06 23:16:20 -08:00
parent 8d90cadc0b
commit a8c5c8123e
5 changed files with 63 additions and 63 deletions

View File

@ -68,7 +68,7 @@ func (az *Cloud) InstanceType(name types.NodeName) (string, error) {
} else if !exists { } else if !exists {
return "", cloudprovider.InstanceNotFound return "", cloudprovider.InstanceNotFound
} }
return string(machine.Properties.HardwareProfile.VMSize), nil return string(machine.HardwareProfile.VMSize), nil
} }
// List lists instances that match 'filter' which is a regular expression which must match the entire instance name (fqdn) // List lists instances that match 'filter' which is a regular expression which must match the entire instance name (fqdn)

View File

@ -57,7 +57,7 @@ func (az *Cloud) GetLoadBalancer(clusterName string, service *v1.Service) (statu
} }
return &v1.LoadBalancerStatus{ return &v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{{IP: *pip.Properties.IPAddress}}, Ingress: []v1.LoadBalancerIngress{{IP: *pip.IPAddress}},
}, true, nil }, true, nil
} }
@ -97,7 +97,7 @@ func (az *Cloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nod
lb = network.LoadBalancer{ lb = network.LoadBalancer{
Name: &lbName, Name: &lbName,
Location: &az.Location, Location: &az.Location,
Properties: &network.LoadBalancerPropertiesFormat{}, LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{},
} }
} }
@ -134,9 +134,9 @@ func (az *Cloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nod
return nil, utilerrors.Flatten(errs) return nil, utilerrors.Flatten(errs)
} }
glog.V(2).Infof("ensure(%s): FINISH - %s", serviceName, *pip.Properties.IPAddress) glog.V(2).Infof("ensure(%s): FINISH - %s", serviceName, *pip.IPAddress)
return &v1.LoadBalancerStatus{ return &v1.LoadBalancerStatus{
Ingress: []v1.LoadBalancerIngress{{IP: *pip.Properties.IPAddress}}, Ingress: []v1.LoadBalancerIngress{{IP: *pip.IPAddress}},
}, nil }, nil
} }
@ -172,7 +172,7 @@ func (az *Cloud) EnsureLoadBalancerDeleted(clusterName string, service *v1.Servi
return reconcileErr return reconcileErr
} }
if lbNeedsUpdate { if lbNeedsUpdate {
if len(*lb.Properties.FrontendIPConfigurations) > 0 { if len(*lb.FrontendIPConfigurations) > 0 {
glog.V(3).Infof("delete(%s): lb(%s) - updating", serviceName, lbName) glog.V(3).Infof("delete(%s): lb(%s) - updating", serviceName, lbName)
_, err = az.LoadBalancerClient.CreateOrUpdate(az.ResourceGroup, *lb.Name, lb, nil) _, err = az.LoadBalancerClient.CreateOrUpdate(az.ResourceGroup, *lb.Name, lb, nil)
if err != nil { if err != nil {
@ -227,7 +227,7 @@ func (az *Cloud) ensurePublicIPExists(serviceName, pipName string) (*network.Pub
pip.Name = to.StringPtr(pipName) pip.Name = to.StringPtr(pipName)
pip.Location = to.StringPtr(az.Location) pip.Location = to.StringPtr(az.Location)
pip.Properties = &network.PublicIPAddressPropertiesFormat{ pip.PublicIPAddressPropertiesFormat = &network.PublicIPAddressPropertiesFormat{
PublicIPAllocationMethod: network.Static, PublicIPAllocationMethod: network.Static,
} }
pip.Tags = &map[string]*string{"service": &serviceName} pip.Tags = &map[string]*string{"service": &serviceName}
@ -273,8 +273,8 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
// Ensure LoadBalancer's Backend Pool Configuration // Ensure LoadBalancer's Backend Pool Configuration
if wantLb { if wantLb {
newBackendPools := []network.BackendAddressPool{} newBackendPools := []network.BackendAddressPool{}
if lb.Properties.BackendAddressPools != nil { if lb.BackendAddressPools != nil {
newBackendPools = *lb.Properties.BackendAddressPools newBackendPools = *lb.BackendAddressPools
} }
foundBackendPool := false foundBackendPool := false
@ -294,15 +294,15 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
glog.V(10).Infof("reconcile(%s)(%t): lb backendpool - adding backendpool", serviceName, wantLb) glog.V(10).Infof("reconcile(%s)(%t): lb backendpool - adding backendpool", serviceName, wantLb)
dirtyLb = true dirtyLb = true
lb.Properties.BackendAddressPools = &newBackendPools lb.BackendAddressPools = &newBackendPools
} }
} }
// Ensure LoadBalancer's Frontend IP Configurations // Ensure LoadBalancer's Frontend IP Configurations
dirtyConfigs := false dirtyConfigs := false
newConfigs := []network.FrontendIPConfiguration{} newConfigs := []network.FrontendIPConfiguration{}
if lb.Properties.FrontendIPConfigurations != nil { if lb.FrontendIPConfigurations != nil {
newConfigs = *lb.Properties.FrontendIPConfigurations newConfigs = *lb.FrontendIPConfigurations
} }
if !wantLb { if !wantLb {
for i := len(newConfigs) - 1; i >= 0; i-- { for i := len(newConfigs) - 1; i >= 0; i-- {
@ -325,7 +325,7 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
newConfigs = append(newConfigs, newConfigs = append(newConfigs,
network.FrontendIPConfiguration{ network.FrontendIPConfiguration{
Name: to.StringPtr(lbFrontendIPConfigName), Name: to.StringPtr(lbFrontendIPConfigName),
Properties: &network.FrontendIPConfigurationPropertiesFormat{ FrontendIPConfigurationPropertiesFormat: &network.FrontendIPConfigurationPropertiesFormat{
PublicIPAddress: &network.PublicIPAddress{ PublicIPAddress: &network.PublicIPAddress{
ID: pip.ID, ID: pip.ID,
}, },
@ -337,7 +337,7 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
} }
if dirtyConfigs { if dirtyConfigs {
dirtyLb = true dirtyLb = true
lb.Properties.FrontendIPConfigurations = &newConfigs lb.FrontendIPConfigurations = &newConfigs
} }
// update probes/rules // update probes/rules
@ -356,7 +356,7 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
expectedProbes[i] = network.Probe{ expectedProbes[i] = network.Probe{
Name: &lbRuleName, Name: &lbRuleName,
Properties: &network.ProbePropertiesFormat{ ProbePropertiesFormat: &network.ProbePropertiesFormat{
RequestPath: to.StringPtr(podPresencePath), RequestPath: to.StringPtr(podPresencePath),
Protocol: network.ProbeProtocolHTTP, Protocol: network.ProbeProtocolHTTP,
Port: to.Int32Ptr(podPresencePort), Port: to.Int32Ptr(podPresencePort),
@ -367,7 +367,7 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
} else { } else {
expectedProbes[i] = network.Probe{ expectedProbes[i] = network.Probe{
Name: &lbRuleName, Name: &lbRuleName,
Properties: &network.ProbePropertiesFormat{ ProbePropertiesFormat: &network.ProbePropertiesFormat{
Protocol: probeProto, Protocol: probeProto,
Port: to.Int32Ptr(port.NodePort), Port: to.Int32Ptr(port.NodePort),
IntervalInSeconds: to.Int32Ptr(5), IntervalInSeconds: to.Int32Ptr(5),
@ -378,7 +378,7 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
expectedRules[i] = network.LoadBalancingRule{ expectedRules[i] = network.LoadBalancingRule{
Name: &lbRuleName, Name: &lbRuleName,
Properties: &network.LoadBalancingRulePropertiesFormat{ LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
Protocol: transportProto, Protocol: transportProto,
FrontendIPConfiguration: &network.SubResource{ FrontendIPConfiguration: &network.SubResource{
ID: to.StringPtr(lbFrontendIPConfigID), ID: to.StringPtr(lbFrontendIPConfigID),
@ -399,8 +399,8 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
// remove unwanted probes // remove unwanted probes
dirtyProbes := false dirtyProbes := false
var updatedProbes []network.Probe var updatedProbes []network.Probe
if lb.Properties.Probes != nil { if lb.Probes != nil {
updatedProbes = *lb.Properties.Probes updatedProbes = *lb.Probes
} }
for i := len(updatedProbes) - 1; i >= 0; i-- { for i := len(updatedProbes) - 1; i >= 0; i-- {
existingProbe := updatedProbes[i] existingProbe := updatedProbes[i]
@ -433,14 +433,14 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
} }
if dirtyProbes { if dirtyProbes {
dirtyLb = true dirtyLb = true
lb.Properties.Probes = &updatedProbes lb.Probes = &updatedProbes
} }
// update rules // update rules
dirtyRules := false dirtyRules := false
var updatedRules []network.LoadBalancingRule var updatedRules []network.LoadBalancingRule
if lb.Properties.LoadBalancingRules != nil { if lb.LoadBalancingRules != nil {
updatedRules = *lb.Properties.LoadBalancingRules updatedRules = *lb.LoadBalancingRules
} }
// update rules: remove unwanted // update rules: remove unwanted
for i := len(updatedRules) - 1; i >= 0; i-- { for i := len(updatedRules) - 1; i >= 0; i-- {
@ -474,7 +474,7 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, pip *network.Pub
} }
if dirtyRules { if dirtyRules {
dirtyLb = true dirtyLb = true
lb.Properties.LoadBalancingRules = &updatedRules lb.LoadBalancingRules = &updatedRules
} }
return lb, dirtyLb, nil return lb, dirtyLb, nil
@ -510,7 +510,7 @@ func (az *Cloud) reconcileSecurityGroup(sg network.SecurityGroup, clusterName st
ix := i*len(sourceAddressPrefixes) + j ix := i*len(sourceAddressPrefixes) + j
expectedSecurityRules[ix] = network.SecurityRule{ expectedSecurityRules[ix] = network.SecurityRule{
Name: to.StringPtr(securityRuleName), Name: to.StringPtr(securityRuleName),
Properties: &network.SecurityRulePropertiesFormat{ SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{
Protocol: securityProto, Protocol: securityProto,
SourcePortRange: to.StringPtr("*"), SourcePortRange: to.StringPtr("*"),
DestinationPortRange: to.StringPtr(strconv.Itoa(int(port.Port))), DestinationPortRange: to.StringPtr(strconv.Itoa(int(port.Port))),
@ -526,8 +526,8 @@ func (az *Cloud) reconcileSecurityGroup(sg network.SecurityGroup, clusterName st
// update security rules // update security rules
dirtySg := false dirtySg := false
var updatedRules []network.SecurityRule var updatedRules []network.SecurityRule
if sg.Properties.SecurityRules != nil { if sg.SecurityRules != nil {
updatedRules = *sg.Properties.SecurityRules updatedRules = *sg.SecurityRules
} }
// update security rules: remove unwanted // update security rules: remove unwanted
for i := len(updatedRules) - 1; i >= 0; i-- { for i := len(updatedRules) - 1; i >= 0; i-- {
@ -561,13 +561,13 @@ func (az *Cloud) reconcileSecurityGroup(sg network.SecurityGroup, clusterName st
return sg, false, err return sg, false, err
} }
expectedRule.Properties.Priority = to.Int32Ptr(nextAvailablePriority) expectedRule.Priority = to.Int32Ptr(nextAvailablePriority)
updatedRules = append(updatedRules, expectedRule) updatedRules = append(updatedRules, expectedRule)
dirtySg = true dirtySg = true
} }
} }
if dirtySg { if dirtySg {
sg.Properties.SecurityRules = &updatedRules sg.SecurityRules = &updatedRules
} }
return sg, dirtySg, nil return sg, dirtySg, nil
} }
@ -620,7 +620,7 @@ func (az *Cloud) ensureHostInPool(serviceName string, nodeName types.NodeName, b
// Check availability set // Check availability set
if az.PrimaryAvailabilitySetName != "" { if az.PrimaryAvailabilitySetName != "" {
expectedAvailabilitySetName := az.getAvailabilitySetID(az.PrimaryAvailabilitySetName) expectedAvailabilitySetName := az.getAvailabilitySetID(az.PrimaryAvailabilitySetName)
if !strings.EqualFold(*machine.Properties.AvailabilitySet.ID, expectedAvailabilitySetName) { if !strings.EqualFold(*machine.AvailabilitySet.ID, expectedAvailabilitySetName) {
glog.V(3).Infof( glog.V(3).Infof(
"nicupdate(%s): skipping nic (%s) since it is not in the primaryAvailabilitSet(%s)", "nicupdate(%s): skipping nic (%s) since it is not in the primaryAvailabilitSet(%s)",
serviceName, nicName, az.PrimaryAvailabilitySetName) serviceName, nicName, az.PrimaryAvailabilitySetName)
@ -641,8 +641,8 @@ func (az *Cloud) ensureHostInPool(serviceName string, nodeName types.NodeName, b
foundPool := false foundPool := false
newBackendPools := []network.BackendAddressPool{} newBackendPools := []network.BackendAddressPool{}
if primaryIPConfig.Properties.LoadBalancerBackendAddressPools != nil { if primaryIPConfig.LoadBalancerBackendAddressPools != nil {
newBackendPools = *primaryIPConfig.Properties.LoadBalancerBackendAddressPools newBackendPools = *primaryIPConfig.LoadBalancerBackendAddressPools
} }
for _, existingPool := range newBackendPools { for _, existingPool := range newBackendPools {
if strings.EqualFold(backendPoolID, *existingPool.ID) { if strings.EqualFold(backendPoolID, *existingPool.ID) {
@ -656,7 +656,7 @@ func (az *Cloud) ensureHostInPool(serviceName string, nodeName types.NodeName, b
ID: to.StringPtr(backendPoolID), ID: to.StringPtr(backendPoolID),
}) })
primaryIPConfig.Properties.LoadBalancerBackendAddressPools = &newBackendPools primaryIPConfig.LoadBalancerBackendAddressPools = &newBackendPools
glog.V(3).Infof("nicupdate(%s): nic(%s) - updating", serviceName, nicName) glog.V(3).Infof("nicupdate(%s): nic(%s) - updating", serviceName, nicName)
_, err := az.InterfacesClient.CreateOrUpdate(az.ResourceGroup, *nic.Name, nic, nil) _, err := az.InterfacesClient.CreateOrUpdate(az.ResourceGroup, *nic.Name, nic, nil)

View File

@ -39,11 +39,11 @@ func (az *Cloud) ListRoutes(clusterName string) (routes []*cloudprovider.Route,
} }
var kubeRoutes []*cloudprovider.Route var kubeRoutes []*cloudprovider.Route
if routeTable.Properties.Routes != nil { if routeTable.Routes != nil {
kubeRoutes = make([]*cloudprovider.Route, len(*routeTable.Properties.Routes)) kubeRoutes = make([]*cloudprovider.Route, len(*routeTable.Routes))
for i, route := range *routeTable.Properties.Routes { for i, route := range *routeTable.Routes {
instance := mapRouteNameToNodeName(*route.Name) instance := mapRouteNameToNodeName(*route.Name)
cidr := *route.Properties.AddressPrefix cidr := *route.AddressPrefix
glog.V(10).Infof("list: * instance=%q, cidr=%q", instance, cidr) glog.V(10).Infof("list: * instance=%q, cidr=%q", instance, cidr)
kubeRoutes[i] = &cloudprovider.Route{ kubeRoutes[i] = &cloudprovider.Route{
@ -72,7 +72,7 @@ func (az *Cloud) CreateRoute(clusterName string, nameHint string, kubeRoute *clo
routeTable = network.RouteTable{ routeTable = network.RouteTable{
Name: to.StringPtr(az.RouteTableName), Name: to.StringPtr(az.RouteTableName),
Location: to.StringPtr(az.Location), Location: to.StringPtr(az.Location),
Properties: &network.RouteTablePropertiesFormat{}, RouteTablePropertiesFormat: &network.RouteTablePropertiesFormat{},
} }
glog.V(3).Infof("create: creating routetable. routeTableName=%q", az.RouteTableName) glog.V(3).Infof("create: creating routetable. routeTableName=%q", az.RouteTableName)
@ -93,12 +93,12 @@ func (az *Cloud) CreateRoute(clusterName string, nameHint string, kubeRoute *clo
// 404 is fatal here // 404 is fatal here
return err return err
} }
if subnet.Properties.RouteTable != nil { if subnet.RouteTable != nil {
if *subnet.Properties.RouteTable.ID != *routeTable.ID { if *subnet.RouteTable.ID != *routeTable.ID {
return fmt.Errorf("The subnet has a route table, but it was unrecognized. Refusing to modify it. active_routetable=%q expected_routetable=%q", *subnet.Properties.RouteTable.ID, *routeTable.ID) return fmt.Errorf("The subnet has a route table, but it was unrecognized. Refusing to modify it. active_routetable=%q expected_routetable=%q", *subnet.RouteTable.ID, *routeTable.ID)
} }
} else { } else {
subnet.Properties.RouteTable = &network.RouteTable{ subnet.RouteTable = &network.RouteTable{
ID: routeTable.ID, ID: routeTable.ID,
} }
glog.V(3).Info("create: updating subnet") glog.V(3).Info("create: updating subnet")
@ -116,7 +116,7 @@ func (az *Cloud) CreateRoute(clusterName string, nameHint string, kubeRoute *clo
routeName := mapNodeNameToRouteName(kubeRoute.TargetNode) routeName := mapNodeNameToRouteName(kubeRoute.TargetNode)
route := network.Route{ route := network.Route{
Name: to.StringPtr(routeName), Name: to.StringPtr(routeName),
Properties: &network.RoutePropertiesFormat{ RoutePropertiesFormat: &network.RoutePropertiesFormat{
AddressPrefix: to.StringPtr(kubeRoute.DestinationCIDR), AddressPrefix: to.StringPtr(kubeRoute.DestinationCIDR),
NextHopType: network.RouteNextHopTypeVirtualAppliance, NextHopType: network.RouteNextHopTypeVirtualAppliance,
NextHopIPAddress: to.StringPtr(targetIP), NextHopIPAddress: to.StringPtr(targetIP),

View File

@ -39,7 +39,7 @@ func (az *Cloud) AttachDisk(diskName, diskURI string, nodeName types.NodeName, l
} else if !exists { } else if !exists {
return cloudprovider.InstanceNotFound return cloudprovider.InstanceNotFound
} }
disks := *vm.Properties.StorageProfile.DataDisks disks := *vm.StorageProfile.DataDisks
disks = append(disks, disks = append(disks,
compute.DataDisk{ compute.DataDisk{
Name: &diskName, Name: &diskName,
@ -53,7 +53,7 @@ func (az *Cloud) AttachDisk(diskName, diskURI string, nodeName types.NodeName, l
newVM := compute.VirtualMachine{ newVM := compute.VirtualMachine{
Location: vm.Location, Location: vm.Location,
Properties: &compute.VirtualMachineProperties{ VirtualMachineProperties: &compute.VirtualMachineProperties{
StorageProfile: &compute.StorageProfile{ StorageProfile: &compute.StorageProfile{
DataDisks: &disks, DataDisks: &disks,
}, },
@ -91,7 +91,7 @@ func (az *Cloud) DisksAreAttached(diskNames []string, nodeName types.NodeName) (
return attached, err return attached, err
} }
disks := *vm.Properties.StorageProfile.DataDisks disks := *vm.StorageProfile.DataDisks
for _, disk := range disks { for _, disk := range disks {
for _, diskName := range diskNames { for _, diskName := range diskNames {
if disk.Name != nil && diskName != "" && *disk.Name == diskName { if disk.Name != nil && diskName != "" && *disk.Name == diskName {
@ -113,7 +113,7 @@ func (az *Cloud) DetachDiskByName(diskName, diskURI string, nodeName types.NodeN
return nil return nil
} }
disks := *vm.Properties.StorageProfile.DataDisks disks := *vm.StorageProfile.DataDisks
for i, disk := range disks { for i, disk := range disks {
if (disk.Name != nil && diskName != "" && *disk.Name == diskName) || (disk.Vhd.URI != nil && diskURI != "" && *disk.Vhd.URI == diskURI) { if (disk.Name != nil && diskName != "" && *disk.Name == diskName) || (disk.Vhd.URI != nil && diskURI != "" && *disk.Vhd.URI == diskURI) {
// found the disk // found the disk
@ -124,7 +124,7 @@ func (az *Cloud) DetachDiskByName(diskName, diskURI string, nodeName types.NodeN
} }
newVM := compute.VirtualMachine{ newVM := compute.VirtualMachine{
Location: vm.Location, Location: vm.Location,
Properties: &compute.VirtualMachineProperties{ VirtualMachineProperties: &compute.VirtualMachineProperties{
StorageProfile: &compute.StorageProfile{ StorageProfile: &compute.StorageProfile{
DataDisks: &disks, DataDisks: &disks,
}, },
@ -148,7 +148,7 @@ func (az *Cloud) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (
} else if !exists { } else if !exists {
return -1, cloudprovider.InstanceNotFound return -1, cloudprovider.InstanceNotFound
} }
disks := *vm.Properties.StorageProfile.DataDisks disks := *vm.StorageProfile.DataDisks
for _, disk := range disks { for _, disk := range disks {
if disk.Lun != nil && (disk.Name != nil && diskName != "" && *disk.Name == diskName) || (disk.Vhd.URI != nil && diskURI != "" && *disk.Vhd.URI == diskURI) { if disk.Lun != nil && (disk.Name != nil && diskName != "" && *disk.Name == diskName) || (disk.Vhd.URI != nil && diskURI != "" && *disk.Vhd.URI == diskURI) {
// found the disk // found the disk
@ -169,7 +169,7 @@ func (az *Cloud) GetNextDiskLun(nodeName types.NodeName) (int32, error) {
return -1, cloudprovider.InstanceNotFound return -1, cloudprovider.InstanceNotFound
} }
used := make([]bool, maxLUN) used := make([]bool, maxLUN)
disks := *vm.Properties.StorageProfile.DataDisks disks := *vm.StorageProfile.DataDisks
for _, disk := range disks { for _, disk := range disks {
if disk.Lun != nil { if disk.Lun != nil {
used[*disk.Lun] = true used[*disk.Lun] = true

View File

@ -133,12 +133,12 @@ func getProtocolsFromKubernetesProtocol(protocol v1.Protocol) (network.Transport
// This returns the full identifier of the primary NIC for the given VM. // This returns the full identifier of the primary NIC for the given VM.
func getPrimaryInterfaceID(machine compute.VirtualMachine) (string, error) { func getPrimaryInterfaceID(machine compute.VirtualMachine) (string, error) {
if len(*machine.Properties.NetworkProfile.NetworkInterfaces) == 1 { if len(*machine.NetworkProfile.NetworkInterfaces) == 1 {
return *(*machine.Properties.NetworkProfile.NetworkInterfaces)[0].ID, nil return *(*machine.NetworkProfile.NetworkInterfaces)[0].ID, nil
} }
for _, ref := range *machine.Properties.NetworkProfile.NetworkInterfaces { for _, ref := range *machine.NetworkProfile.NetworkInterfaces {
if *ref.Properties.Primary { if *ref.Primary {
return *ref.ID, nil return *ref.ID, nil
} }
} }
@ -147,12 +147,12 @@ func getPrimaryInterfaceID(machine compute.VirtualMachine) (string, error) {
} }
func getPrimaryIPConfig(nic network.Interface) (*network.InterfaceIPConfiguration, error) { func getPrimaryIPConfig(nic network.Interface) (*network.InterfaceIPConfiguration, error) {
if len(*nic.Properties.IPConfigurations) == 1 { if len(*nic.IPConfigurations) == 1 {
return &((*nic.Properties.IPConfigurations)[0]), nil return &((*nic.IPConfigurations)[0]), nil
} }
for _, ref := range *nic.Properties.IPConfigurations { for _, ref := range *nic.IPConfigurations {
if *ref.Properties.Primary { if *ref.Primary {
return &ref, nil return &ref, nil
} }
} }
@ -204,7 +204,7 @@ func getNextAvailablePriority(rules []network.SecurityRule) (int32, error) {
outer: outer:
for smallest < loadBalancerMaximumPriority { for smallest < loadBalancerMaximumPriority {
for _, rule := range rules { for _, rule := range rules {
if *rule.Properties.Priority == smallest { if *rule.Priority == smallest {
smallest += spread smallest += spread
continue outer continue outer
} }
@ -245,6 +245,6 @@ func (az *Cloud) getIPForMachine(nodeName types.NodeName) (string, error) {
return "", err return "", err
} }
targetIP := *ipConfig.Properties.PrivateIPAddress targetIP := *ipConfig.PrivateIPAddress
return targetIP, nil return targetIP, nil
} }