Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2423e7c5
Commit
2423e7c5
authored
Jan 10, 2018
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up azure rateLimiter and verbose logs
parent
d2d48cdd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
5 additions
and
139 deletions
+5
-139
BUILD
pkg/cloudprovider/providers/azure/BUILD
+2
-1
azure_backoff.go
pkg/cloudprovider/providers/azure/azure_backoff.go
+0
-41
azure_controllerCommon.go
pkg/cloudprovider/providers/azure/azure_controllerCommon.go
+0
-2
azure_loadbalancer.go
pkg/cloudprovider/providers/azure/azure_loadbalancer.go
+2
-12
azure_routes.go
pkg/cloudprovider/providers/azure/azure_routes.go
+0
-6
azure_storageaccount.go
pkg/cloudprovider/providers/azure/azure_storageaccount.go
+0
-8
azure_test.go
pkg/cloudprovider/providers/azure/azure_test.go
+0
-2
azure_util.go
pkg/cloudprovider/providers/azure/azure_util.go
+0
-7
azure_util_vmss.go
pkg/cloudprovider/providers/azure/azure_util_vmss.go
+0
-33
azure_wrap.go
pkg/cloudprovider/providers/azure/azure_wrap.go
+1
-27
No files found.
pkg/cloudprovider/providers/azure/BUILD
View file @
2423e7c5
...
...
@@ -12,6 +12,7 @@ go_library(
"azure.go",
"azure_backoff.go",
"azure_blobDiskController.go",
"azure_client.go",
"azure_controllerCommon.go",
"azure_fakes.go",
"azure_file.go",
...
...
@@ -42,6 +43,7 @@ go_library(
"//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/storage:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/adal:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library",
"//vendor/github.com/ghodss/yaml:go_default_library",
...
...
@@ -80,7 +82,6 @@ go_test(
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/client-go/util/flowcontrol:go_default_library",
],
)
...
...
pkg/cloudprovider/providers/azure/azure_backoff.go
View file @
2423e7c5
This diff is collapsed.
Click to expand it.
pkg/cloudprovider/providers/azure/azure_controllerCommon.go
View file @
2423e7c5
...
...
@@ -110,7 +110,6 @@ func (c *controllerCommon) AttachDisk(isManagedDisk bool, diskName, diskURI stri
}
vmName
:=
mapNodeNameToVMName
(
nodeName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - attach disk"
,
c
.
resourceGroup
,
vmName
)
c
.
cloud
.
operationPollRateLimiter
.
Accept
()
respChan
,
errChan
:=
c
.
cloud
.
VirtualMachinesClient
.
CreateOrUpdate
(
c
.
resourceGroup
,
vmName
,
newVM
,
nil
)
resp
:=
<-
respChan
err
=
<-
errChan
...
...
@@ -176,7 +175,6 @@ func (c *controllerCommon) DetachDiskByName(diskName, diskURI string, nodeName t
}
vmName
:=
mapNodeNameToVMName
(
nodeName
)
glog
.
V
(
2
)
.
Infof
(
"azureDisk - update(%s): vm(%s) - detach disk"
,
c
.
resourceGroup
,
vmName
)
c
.
cloud
.
operationPollRateLimiter
.
Accept
()
respChan
,
errChan
:=
c
.
cloud
.
VirtualMachinesClient
.
CreateOrUpdate
(
c
.
resourceGroup
,
vmName
,
newVM
,
nil
)
resp
:=
<-
respChan
err
=
<-
errChan
...
...
pkg/cloudprovider/providers/azure/azure_loadbalancer.go
View file @
2423e7c5
...
...
@@ -415,7 +415,6 @@ func (az *Cloud) ensurePublicIPExists(service *v1.Service, pipName string, domai
}
pip
.
Tags
=
&
map
[
string
]
*
string
{
"service"
:
&
serviceName
}
glog
.
V
(
3
)
.
Infof
(
"ensure(%s): pip(%s) - creating"
,
serviceName
,
*
pip
.
Name
)
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"CreateOrUpdatePIPWithRetry(%s, %q): start"
,
pipResourceGroup
,
*
pip
.
Name
)
err
=
az
.
CreateOrUpdatePIPWithRetry
(
pipResourceGroup
,
pip
)
if
err
!=
nil
{
...
...
@@ -424,10 +423,7 @@ func (az *Cloud) ensurePublicIPExists(service *v1.Service, pipName string, domai
}
glog
.
V
(
10
)
.
Infof
(
"CreateOrUpdatePIPWithRetry(%s, %q): end"
,
pipResourceGroup
,
*
pip
.
Name
)
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"PublicIPAddressesClient.Get(%s, %q): start"
,
pipResourceGroup
,
*
pip
.
Name
)
pip
,
err
=
az
.
PublicIPAddressesClient
.
Get
(
pipResourceGroup
,
*
pip
.
Name
,
""
)
glog
.
V
(
10
)
.
Infof
(
"PublicIPAddressesClient.Get(%s, %q): end"
,
pipResourceGroup
,
*
pip
.
Name
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -762,14 +758,13 @@ func (az *Cloud) reconcileLoadBalancer(clusterName string, service *v1.Service,
glog
.
V
(
10
)
.
Infof
(
"EnsureBackendPoolDeleted(%s, %s): end"
,
lbBackendPoolID
,
vmSetName
)
// Remove the LB.
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"LoadBalancerClient.Delete(%q): start"
,
lbName
)
glog
.
V
(
10
)
.
Infof
(
"az.DeleteLBWithRetry(%q): start"
,
lbName
)
err
=
az
.
DeleteLBWithRetry
(
lbName
)
if
err
!=
nil
{
glog
.
V
(
2
)
.
Infof
(
"delete(%s) abort backoff: lb(%s) - deleting; no remaining frontendipconfigs"
,
serviceName
,
lbName
)
return
nil
,
err
}
glog
.
V
(
10
)
.
Infof
(
"
LoadBalancerClient.Delete
(%q): end"
,
lbName
)
glog
.
V
(
10
)
.
Infof
(
"
az.DeleteLBWithRetry
(%q): end"
,
lbName
)
}
else
{
glog
.
V
(
3
)
.
Infof
(
"ensure(%s): lb(%s) - updating"
,
serviceName
,
lbName
)
err
:=
az
.
CreateOrUpdateLBWithRetry
(
*
lb
)
...
...
@@ -808,10 +803,7 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
ports
=
[]
v1
.
ServicePort
{}
}
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"SecurityGroupsClient.Get(%q): start"
,
az
.
SecurityGroupName
)
sg
,
err
:=
az
.
SecurityGroupsClient
.
Get
(
az
.
ResourceGroup
,
az
.
SecurityGroupName
,
""
)
glog
.
V
(
10
)
.
Infof
(
"SecurityGroupsClient.Get(%q): end"
,
az
.
SecurityGroupName
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -980,7 +972,6 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
if
dirtySg
{
sg
.
SecurityRules
=
&
updatedRules
glog
.
V
(
3
)
.
Infof
(
"ensure(%s): sg(%s) - updating"
,
serviceName
,
*
sg
.
Name
)
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"CreateOrUpdateSGWithRetry(%q): start"
,
*
sg
.
Name
)
err
:=
az
.
CreateOrUpdateSGWithRetry
(
sg
)
if
err
!=
nil
{
...
...
@@ -1169,7 +1160,6 @@ func (az *Cloud) reconcilePublicIP(clusterName string, service *v1.Service, want
// Public ip resource with match service tag
}
else
{
glog
.
V
(
2
)
.
Infof
(
"ensure(%s): pip(%s) - deleting"
,
serviceName
,
pipName
)
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"DeletePublicIPWithRetry(%s, %q): start"
,
pipResourceGroup
,
pipName
)
err
=
az
.
DeletePublicIPWithRetry
(
pipResourceGroup
,
pipName
)
if
err
!=
nil
{
...
...
pkg/cloudprovider/providers/azure/azure_routes.go
View file @
2423e7c5
...
...
@@ -77,8 +77,6 @@ func (az *Cloud) CreateRoute(clusterName string, nameHint string, kubeRoute *clo
}
glog
.
V
(
3
)
.
Infof
(
"create: creating routetable. routeTableName=%q"
,
az
.
RouteTableName
)
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"RouteTablesClient.CreateOrUpdate(%q): start"
,
az
.
RouteTableName
)
respChan
,
errChan
:=
az
.
RouteTablesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
az
.
RouteTableName
,
routeTable
,
nil
)
resp
:=
<-
respChan
err
:=
<-
errChan
...
...
@@ -119,8 +117,6 @@ func (az *Cloud) CreateRoute(clusterName string, nameHint string, kubeRoute *clo
}
glog
.
V
(
3
)
.
Infof
(
"create: creating route: instance=%q cidr=%q"
,
kubeRoute
.
TargetNode
,
kubeRoute
.
DestinationCIDR
)
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"RoutesClient.CreateOrUpdate(%q): start"
,
az
.
RouteTableName
)
respChan
,
errChan
:=
az
.
RoutesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
az
.
RouteTableName
,
*
route
.
Name
,
route
,
nil
)
resp
:=
<-
respChan
err
=
<-
errChan
...
...
@@ -147,8 +143,6 @@ func (az *Cloud) DeleteRoute(clusterName string, kubeRoute *cloudprovider.Route)
glog
.
V
(
2
)
.
Infof
(
"delete: deleting route. clusterName=%q instance=%q cidr=%q"
,
clusterName
,
kubeRoute
.
TargetNode
,
kubeRoute
.
DestinationCIDR
)
routeName
:=
mapNodeNameToRouteName
(
kubeRoute
.
TargetNode
)
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"RoutesClient.Delete(%q): start"
,
az
.
RouteTableName
)
respChan
,
errChan
:=
az
.
RoutesClient
.
Delete
(
az
.
ResourceGroup
,
az
.
RouteTableName
,
routeName
,
nil
)
resp
:=
<-
respChan
err
:=
<-
errChan
...
...
pkg/cloudprovider/providers/azure/azure_storageaccount.go
View file @
2423e7c5
...
...
@@ -19,8 +19,6 @@ package azure
import
(
"fmt"
"strings"
"github.com/golang/glog"
)
type
accountWithLocation
struct
{
...
...
@@ -29,10 +27,7 @@ type accountWithLocation struct {
// getStorageAccounts gets the storage accounts' name, type, location in a resource group
func
(
az
*
Cloud
)
getStorageAccounts
()
([]
accountWithLocation
,
error
)
{
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"StorageAccountClient.ListByResourceGroup(%v): start"
,
az
.
ResourceGroup
)
result
,
err
:=
az
.
StorageAccountClient
.
ListByResourceGroup
(
az
.
ResourceGroup
)
glog
.
V
(
10
)
.
Infof
(
"StorageAccountClient.ListByResourceGroup(%v): end"
,
az
.
ResourceGroup
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -61,10 +56,7 @@ func (az *Cloud) getStorageAccounts() ([]accountWithLocation, error) {
// getStorageAccesskey gets the storage account access key
func
(
az
*
Cloud
)
getStorageAccesskey
(
account
string
)
(
string
,
error
)
{
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"StorageAccountClient.ListKeys(%q): start"
,
account
)
result
,
err
:=
az
.
StorageAccountClient
.
ListKeys
(
az
.
ResourceGroup
,
account
)
glog
.
V
(
10
)
.
Infof
(
"StorageAccountClient.ListKeys(%q): end"
,
account
)
if
err
!=
nil
{
return
""
,
err
}
...
...
pkg/cloudprovider/providers/azure/azure_test.go
View file @
2423e7c5
...
...
@@ -25,7 +25,6 @@ import (
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/util/flowcontrol"
serviceapi
"k8s.io/kubernetes/pkg/api/v1/service"
"k8s.io/kubernetes/pkg/cloudprovider/providers/azure/auth"
kubeletapis
"k8s.io/kubernetes/pkg/kubelet/apis"
...
...
@@ -862,7 +861,6 @@ func getTestCloud() (az *Cloud) {
MaximumLoadBalancerRuleCount
:
250
,
},
}
az
.
operationPollRateLimiter
=
flowcontrol
.
NewTokenBucketRateLimiter
(
100
,
100
)
az
.
LoadBalancerClient
=
newFakeAzureLBClient
()
az
.
PublicIPAddressesClient
=
newFakeAzurePIPClient
(
az
.
Config
.
SubscriptionID
)
az
.
SubnetsClient
=
newFakeAzureSubnetsClient
()
...
...
pkg/cloudprovider/providers/azure/azure_util.go
View file @
2423e7c5
...
...
@@ -389,7 +389,6 @@ func (as *availabilitySet) GetInstanceIDByNodeName(name string) (string, error)
var
machine
compute
.
VirtualMachine
var
err
error
as
.
operationPollRateLimiter
.
Accept
()
machine
,
err
=
as
.
getVirtualMachine
(
types
.
NodeName
(
name
))
if
err
!=
nil
{
if
as
.
CloudProviderBackoff
{
...
...
@@ -563,7 +562,6 @@ func (as *availabilitySet) GetVMSetNames(service *v1.Service, nodes []*v1.Node)
func
(
as
*
availabilitySet
)
GetPrimaryInterface
(
nodeName
,
vmSetName
string
)
(
network
.
Interface
,
error
)
{
var
machine
compute
.
VirtualMachine
as
.
operationPollRateLimiter
.
Accept
()
machine
,
err
:=
as
.
GetVirtualMachineWithRetry
(
types
.
NodeName
(
nodeName
))
if
err
!=
nil
{
glog
.
V
(
2
)
.
Infof
(
"GetPrimaryInterface(%s, %s) abort backoff"
,
nodeName
,
vmSetName
)
...
...
@@ -589,10 +587,7 @@ func (as *availabilitySet) GetPrimaryInterface(nodeName, vmSetName string) (netw
}
}
as
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"InterfacesClient.Get(%q): start"
,
nicName
)
nic
,
err
:=
as
.
InterfacesClient
.
Get
(
as
.
ResourceGroup
,
nicName
,
""
)
glog
.
V
(
10
)
.
Infof
(
"InterfacesClient.Get(%q): end"
,
nicName
)
if
err
!=
nil
{
return
network
.
Interface
{},
err
}
...
...
@@ -642,8 +637,6 @@ func (as *availabilitySet) ensureHostInPool(serviceName string, nodeName types.N
nicName
:=
*
nic
.
Name
glog
.
V
(
3
)
.
Infof
(
"nicupdate(%s): nic(%s) - updating"
,
serviceName
,
nicName
)
as
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"InterfacesClient.CreateOrUpdate(%q): start"
,
*
nic
.
Name
)
respChan
,
errChan
:=
as
.
InterfacesClient
.
CreateOrUpdate
(
as
.
ResourceGroup
,
*
nic
.
Name
,
nic
,
nil
)
resp
:=
<-
respChan
err
:=
<-
errChan
...
...
pkg/cloudprovider/providers/azure/azure_util_vmss.go
View file @
2423e7c5
...
...
@@ -401,10 +401,7 @@ func (ss *scaleSet) listScaleSetsWithRetry() ([]string, error) {
allScaleSets
:=
make
([]
string
,
0
)
backoffError
:=
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.List start for %v"
,
ss
.
ResourceGroup
)
result
,
err
=
ss
.
VirtualMachineScaleSetsClient
.
List
(
ss
.
ResourceGroup
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.List end for %v"
,
ss
.
ResourceGroup
)
if
err
!=
nil
{
glog
.
Errorf
(
"VirtualMachineScaleSetsClient.List for %v failed: %v"
,
ss
.
ResourceGroup
,
err
)
return
false
,
err
...
...
@@ -425,10 +422,7 @@ func (ss *scaleSet) listScaleSetsWithRetry() ([]string, error) {
if
result
.
NextLink
!=
nil
{
backoffError
:=
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.ListNextResults start for %v"
,
ss
.
ResourceGroup
)
result
,
err
=
ss
.
VirtualMachineScaleSetsClient
.
ListNextResults
(
result
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.ListNextResults end for %v"
,
ss
.
ResourceGroup
)
if
err
!=
nil
{
glog
.
Errorf
(
"VirtualMachineScaleSetsClient.ListNextResults for %v failed: %v"
,
ss
.
ResourceGroup
,
err
)
return
false
,
err
...
...
@@ -455,10 +449,7 @@ func (ss *scaleSet) listScaleSetVMsWithRetry(scaleSetName string) ([]compute.Vir
allVMs
:=
make
([]
compute
.
VirtualMachineScaleSetVM
,
0
)
backoffError
:=
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetVMsClient.List start for %v"
,
scaleSetName
)
result
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
List
(
ss
.
ResourceGroup
,
scaleSetName
,
""
,
""
,
string
(
compute
.
InstanceView
))
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetVMsClient.List end for %v"
,
scaleSetName
)
if
err
!=
nil
{
glog
.
Errorf
(
"VirtualMachineScaleSetVMsClient.List for %v failed: %v"
,
scaleSetName
,
err
)
return
false
,
err
...
...
@@ -477,10 +468,7 @@ func (ss *scaleSet) listScaleSetVMsWithRetry(scaleSetName string) ([]compute.Vir
if
result
.
NextLink
!=
nil
{
backoffError
:=
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetVMsClient.ListNextResults start for %v"
,
scaleSetName
)
result
,
err
=
ss
.
VirtualMachineScaleSetVMsClient
.
ListNextResults
(
result
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetVMsClient.ListNextResults end for %v"
,
ss
.
ResourceGroup
)
if
err
!=
nil
{
glog
.
Errorf
(
"VirtualMachineScaleSetVMsClient.ListNextResults for %v failed: %v"
,
scaleSetName
,
err
)
return
false
,
err
...
...
@@ -622,10 +610,7 @@ func (ss *scaleSet) GetPrimaryInterface(nodeName, vmSetName string) (network.Int
return
network
.
Interface
{},
err
}
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"InterfacesClient.Get(%q): start"
,
nicName
)
nic
,
err
:=
ss
.
InterfacesClient
.
GetVirtualMachineScaleSetNetworkInterface
(
ss
.
ResourceGroup
,
vm
.
ScaleSetName
,
vm
.
InstanceID
,
nicName
,
""
)
glog
.
V
(
10
)
.
Infof
(
"InterfacesClient.Get(%q): end"
,
nicName
)
if
err
!=
nil
{
glog
.
Errorf
(
"error: ss.GetPrimaryInterface(%s), ss.GetVirtualMachineScaleSetNetworkInterface.Get(%s, %s, %s), err=%v"
,
nodeName
,
ss
.
ResourceGroup
,
vm
.
ScaleSetName
,
nicName
,
err
)
return
network
.
Interface
{},
err
...
...
@@ -642,11 +627,7 @@ func (ss *scaleSet) GetPrimaryInterface(nodeName, vmSetName string) (network.Int
// getScaleSet gets a scale set by name.
func
(
ss
*
scaleSet
)
getScaleSet
(
name
string
)
(
compute
.
VirtualMachineScaleSet
,
bool
,
error
)
{
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.Get(%s): start"
,
name
)
result
,
err
:=
ss
.
VirtualMachineScaleSetsClient
.
Get
(
ss
.
ResourceGroup
,
name
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.Get(%s): end"
,
name
)
exists
,
realErr
:=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
result
,
false
,
realErr
...
...
@@ -714,8 +695,6 @@ func (ss *scaleSet) getPrimaryIPConfigForScaleSet(config *compute.VirtualMachine
// createOrUpdateVMSSWithRetry invokes ss.VirtualMachineScaleSetsClient.CreateOrUpdate with exponential backoff retry.
func
(
ss
*
scaleSet
)
createOrUpdateVMSSWithRetry
(
virtualMachineScaleSet
compute
.
VirtualMachineScaleSet
)
error
{
return
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.CreateOrUpdate(%s): start"
,
*
virtualMachineScaleSet
.
Name
)
respChan
,
errChan
:=
ss
.
VirtualMachineScaleSetsClient
.
CreateOrUpdate
(
ss
.
ResourceGroup
,
*
virtualMachineScaleSet
.
Name
,
virtualMachineScaleSet
,
nil
)
resp
:=
<-
respChan
err
:=
<-
errChan
...
...
@@ -727,8 +706,6 @@ func (ss *scaleSet) createOrUpdateVMSSWithRetry(virtualMachineScaleSet compute.V
// updateVMSSInstancesWithRetry invokes ss.VirtualMachineScaleSetsClient.UpdateInstances with exponential backoff retry.
func
(
ss
*
scaleSet
)
updateVMSSInstancesWithRetry
(
scaleSetName
string
,
vmInstanceIDs
compute
.
VirtualMachineScaleSetVMInstanceRequiredIDs
)
error
{
return
wait
.
ExponentialBackoff
(
ss
.
requestBackoff
(),
func
()
(
bool
,
error
)
{
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.UpdateInstances(%s): start"
,
scaleSetName
)
respChan
,
errChan
:=
ss
.
VirtualMachineScaleSetsClient
.
UpdateInstances
(
ss
.
ResourceGroup
,
scaleSetName
,
vmInstanceIDs
,
nil
)
resp
:=
<-
respChan
err
:=
<-
errChan
...
...
@@ -784,8 +761,6 @@ func (ss *scaleSet) EnsureHostsInPool(serviceName string, nodes []*v1.Node, back
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
=
&
newBackendPools
glog
.
V
(
3
)
.
Infof
(
"VirtualMachineScaleSetsClient.CreateOrUpdate for service (%s): scale set (%s) - updating"
,
serviceName
,
vmSetName
)
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.CreateOrUpdate(%q): start"
,
vmSetName
)
respChan
,
errChan
:=
ss
.
VirtualMachineScaleSetsClient
.
CreateOrUpdate
(
ss
.
ResourceGroup
,
vmSetName
,
virtualMachineScaleSet
,
nil
)
resp
:=
<-
respChan
err
:=
<-
errChan
...
...
@@ -829,8 +804,6 @@ func (ss *scaleSet) EnsureHostsInPool(serviceName string, nodes []*v1.Node, back
vmInstanceIDs
:=
compute
.
VirtualMachineScaleSetVMInstanceRequiredIDs
{
InstanceIds
:
&
instanceIDs
,
}
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.UpdateInstances(%q): start"
,
vmSetName
)
respChan
,
errChan
:=
ss
.
VirtualMachineScaleSetsClient
.
UpdateInstances
(
ss
.
ResourceGroup
,
vmSetName
,
vmInstanceIDs
,
nil
)
resp
:=
<-
respChan
err
=
<-
errChan
...
...
@@ -898,8 +871,6 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(poolID, vmSetName string) error {
// Update scale set with backoff.
primaryIPConfiguration
.
LoadBalancerBackendAddressPools
=
&
newBackendPools
glog
.
V
(
3
)
.
Infof
(
"VirtualMachineScaleSetsClient.CreateOrUpdate: scale set (%s) - updating"
,
vmSetName
)
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.CreateOrUpdate(%q): start"
,
vmSetName
)
respChan
,
errChan
:=
ss
.
VirtualMachineScaleSetsClient
.
CreateOrUpdate
(
ss
.
ResourceGroup
,
vmSetName
,
virtualMachineScaleSet
,
nil
)
resp
:=
<-
respChan
err
=
<-
errChan
...
...
@@ -921,8 +892,6 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(poolID, vmSetName string) error {
vmInstanceIDs
:=
compute
.
VirtualMachineScaleSetVMInstanceRequiredIDs
{
InstanceIds
:
&
instanceIDs
,
}
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.UpdateInstances(%q): start"
,
vmSetName
)
updateRespChan
,
errChan
:=
ss
.
VirtualMachineScaleSetsClient
.
UpdateInstances
(
ss
.
ResourceGroup
,
vmSetName
,
vmInstanceIDs
,
nil
)
updateResp
:=
<-
updateRespChan
err
=
<-
errChan
...
...
@@ -943,8 +912,6 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(poolID, vmSetName string) error {
// TODO: remove this workaround when figuring out the root cause.
if
len
(
newBackendPools
)
==
0
{
glog
.
V
(
3
)
.
Infof
(
"VirtualMachineScaleSetsClient.CreateOrUpdate: scale set (%s) - updating second time"
,
vmSetName
)
ss
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachineScaleSetsClient.CreateOrUpdate(%q): start"
,
vmSetName
)
respChan
,
errChan
=
ss
.
VirtualMachineScaleSetsClient
.
CreateOrUpdate
(
ss
.
ResourceGroup
,
vmSetName
,
virtualMachineScaleSet
,
nil
)
resp
=
<-
respChan
err
=
<-
errChan
...
...
pkg/cloudprovider/providers/azure/azure_wrap.go
View file @
2423e7c5
...
...
@@ -96,11 +96,7 @@ func (az *Cloud) getVirtualMachine(nodeName types.NodeName) (vm compute.VirtualM
// case we do get instance view every time to fulfill the azure_zones requirement without hitting
// throttling.
// Consider adding separate parameter for controlling 'InstanceView' once node update issue #56276 is fixed
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"VirtualMachinesClient.Get(%s): start"
,
vmName
)
vm
,
err
=
az
.
VirtualMachinesClient
.
Get
(
az
.
ResourceGroup
,
vmName
,
compute
.
InstanceView
)
glog
.
V
(
10
)
.
Infof
(
"VirtualMachinesClient.Get(%s): end"
,
vmName
)
exists
,
realErr
:=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
vm
,
realErr
...
...
@@ -122,11 +118,7 @@ func (az *Cloud) getVirtualMachine(nodeName types.NodeName) (vm compute.VirtualM
func
(
az
*
Cloud
)
getRouteTable
()
(
routeTable
network
.
RouteTable
,
exists
bool
,
err
error
)
{
var
realErr
error
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"RouteTablesClient.Get(%s): start"
,
az
.
RouteTableName
)
routeTable
,
err
=
az
.
RouteTablesClient
.
Get
(
az
.
ResourceGroup
,
az
.
RouteTableName
,
""
)
glog
.
V
(
10
)
.
Infof
(
"RouteTablesClient.Get(%s): end"
,
az
.
RouteTableName
)
exists
,
realErr
=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
routeTable
,
false
,
realErr
...
...
@@ -142,11 +134,7 @@ func (az *Cloud) getRouteTable() (routeTable network.RouteTable, exists bool, er
func
(
az
*
Cloud
)
getSecurityGroup
()
(
sg
network
.
SecurityGroup
,
exists
bool
,
err
error
)
{
var
realErr
error
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"SecurityGroupsClient.Get(%s): start"
,
az
.
SecurityGroupName
)
sg
,
err
=
az
.
SecurityGroupsClient
.
Get
(
az
.
ResourceGroup
,
az
.
SecurityGroupName
,
""
)
glog
.
V
(
10
)
.
Infof
(
"SecurityGroupsClient.Get(%s): end"
,
az
.
SecurityGroupName
)
exists
,
realErr
=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
sg
,
false
,
realErr
...
...
@@ -161,11 +149,8 @@ func (az *Cloud) getSecurityGroup() (sg network.SecurityGroup, exists bool, err
func
(
az
*
Cloud
)
getAzureLoadBalancer
(
name
string
)
(
lb
network
.
LoadBalancer
,
exists
bool
,
err
error
)
{
var
realErr
error
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"LoadBalancerClient.Get(%s): start"
,
name
)
lb
,
err
=
az
.
LoadBalancerClient
.
Get
(
az
.
ResourceGroup
,
name
,
""
)
glog
.
V
(
10
)
.
Infof
(
"LoadBalancerClient.Get(%s): end"
,
name
)
lb
,
err
=
az
.
LoadBalancerClient
.
Get
(
az
.
ResourceGroup
,
name
,
""
)
exists
,
realErr
=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
lb
,
false
,
realErr
...
...
@@ -181,10 +166,7 @@ func (az *Cloud) getAzureLoadBalancer(name string) (lb network.LoadBalancer, exi
func
(
az
*
Cloud
)
listLoadBalancers
()
(
lbListResult
network
.
LoadBalancerListResult
,
exists
bool
,
err
error
)
{
var
realErr
error
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"LoadBalancerClient.List(%s): start"
,
az
.
ResourceGroup
)
lbListResult
,
err
=
az
.
LoadBalancerClient
.
List
(
az
.
ResourceGroup
)
glog
.
V
(
10
)
.
Infof
(
"LoadBalancerClient.List(%s): end"
,
az
.
ResourceGroup
)
exists
,
realErr
=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
lbListResult
,
false
,
realErr
...
...
@@ -204,11 +186,7 @@ func (az *Cloud) getPublicIPAddress(pipResourceGroup string, pipName string) (pi
}
var
realErr
error
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"PublicIPAddressesClient.Get(%s, %s): start"
,
resourceGroup
,
pipName
)
pip
,
err
=
az
.
PublicIPAddressesClient
.
Get
(
resourceGroup
,
pipName
,
""
)
glog
.
V
(
10
)
.
Infof
(
"PublicIPAddressesClient.Get(%s, %s): end"
,
resourceGroup
,
pipName
)
exists
,
realErr
=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
pip
,
false
,
realErr
...
...
@@ -231,11 +209,7 @@ func (az *Cloud) getSubnet(virtualNetworkName string, subnetName string) (subnet
rg
=
az
.
ResourceGroup
}
az
.
operationPollRateLimiter
.
Accept
()
glog
.
V
(
10
)
.
Infof
(
"SubnetsClient.Get(%s): start"
,
subnetName
)
subnet
,
err
=
az
.
SubnetsClient
.
Get
(
rg
,
virtualNetworkName
,
subnetName
,
""
)
glog
.
V
(
10
)
.
Infof
(
"SubnetsClient.Get(%s): end"
,
subnetName
)
exists
,
realErr
=
checkResourceExistsFromError
(
err
)
if
realErr
!=
nil
{
return
subnet
,
false
,
realErr
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment