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
6d73a09d
Commit
6d73a09d
authored
Jun 06, 2017
by
Jack Francis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rate limiting everywhere
not waiting to rate limit until we get an error response from the API, doing so on initial request for all API requests
parent
148e923f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
0 deletions
+14
-0
azure_instances.go
pkg/cloudprovider/providers/azure/azure_instances.go
+1
-0
azure_loadbalancer.go
pkg/cloudprovider/providers/azure/azure_loadbalancer.go
+8
-0
azure_routes.go
pkg/cloudprovider/providers/azure/azure_routes.go
+3
-0
azure_storage.go
pkg/cloudprovider/providers/azure/azure_storage.go
+2
-0
No files found.
pkg/cloudprovider/providers/azure/azure_instances.go
View file @
6d73a09d
...
...
@@ -60,6 +60,7 @@ func (az *Cloud) InstanceID(name types.NodeName) (string, error) {
var
machine
compute
.
VirtualMachine
var
exists
bool
var
err
error
az
.
operationPollRateLimiter
.
Accept
()
machine
,
exists
,
err
=
az
.
getVirtualMachine
(
name
)
if
err
!=
nil
{
if
az
.
CloudProviderBackoff
{
...
...
pkg/cloudprovider/providers/azure/azure_loadbalancer.go
View file @
6d73a09d
...
...
@@ -151,6 +151,7 @@ func (az *Cloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nod
// to nil. This is a workaround until https://github.com/Azure/go-autorest/issues/112 is fixed
sg
.
SecurityGroupPropertiesFormat
.
NetworkInterfaces
=
nil
sg
.
SecurityGroupPropertiesFormat
.
Subnets
=
nil
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
SecurityGroupsClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
*
sg
.
Name
,
sg
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"ensure(%s) backing off: sg(%s) - updating"
,
serviceName
,
*
sg
.
Name
)
...
...
@@ -229,6 +230,7 @@ func (az *Cloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nod
}
if
!
existsLb
||
lbNeedsUpdate
{
glog
.
V
(
3
)
.
Infof
(
"ensure(%s): lb(%s) - updating"
,
serviceName
,
lbName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
LoadBalancerClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
*
lb
.
Name
,
lb
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"ensure(%s) backing off: lb(%s) - updating"
,
serviceName
,
lbName
)
...
...
@@ -328,6 +330,7 @@ func (az *Cloud) EnsureLoadBalancerDeleted(clusterName string, service *v1.Servi
// to nil. This is a workaround until https://github.com/Azure/go-autorest/issues/112 is fixed
sg
.
SecurityGroupPropertiesFormat
.
NetworkInterfaces
=
nil
sg
.
SecurityGroupPropertiesFormat
.
Subnets
=
nil
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
SecurityGroupsClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
*
reconciledSg
.
Name
,
reconciledSg
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"delete(%s) backing off: sg(%s) - updating"
,
serviceName
,
az
.
SecurityGroupName
)
...
...
@@ -365,6 +368,7 @@ func (az *Cloud) cleanupLoadBalancer(clusterName string, service *v1.Service, is
if
lbNeedsUpdate
{
if
len
(
*
lb
.
FrontendIPConfigurations
)
>
0
{
glog
.
V
(
3
)
.
Infof
(
"delete(%s): lb(%s) - updating"
,
serviceName
,
lbName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
LoadBalancerClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
*
lb
.
Name
,
lb
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"delete(%s) backing off: sg(%s) - updating"
,
serviceName
,
az
.
SecurityGroupName
)
...
...
@@ -380,6 +384,7 @@ func (az *Cloud) cleanupLoadBalancer(clusterName string, service *v1.Service, is
}
else
{
glog
.
V
(
3
)
.
Infof
(
"delete(%s): lb(%s) - deleting; no remaining frontendipconfigs"
,
serviceName
,
lbName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
LoadBalancerClient
.
Delete
(
az
.
ResourceGroup
,
lbName
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"delete(%s) backing off: lb(%s) - deleting; no remaining frontendipconfigs"
,
serviceName
,
lbName
)
...
...
@@ -434,6 +439,7 @@ func (az *Cloud) ensurePublicIPExists(serviceName, pipName string) (*network.Pub
pip
.
Tags
=
&
map
[
string
]
*
string
{
"service"
:
&
serviceName
}
glog
.
V
(
3
)
.
Infof
(
"ensure(%s): pip(%s) - creating"
,
serviceName
,
*
pip
.
Name
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
PublicIPAddressesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
*
pip
.
Name
,
pip
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"ensure(%s) backing off: pip(%s) - creating"
,
serviceName
,
*
pip
.
Name
)
...
...
@@ -459,6 +465,7 @@ func (az *Cloud) ensurePublicIPExists(serviceName, pipName string) (*network.Pub
func
(
az
*
Cloud
)
ensurePublicIPDeleted
(
serviceName
,
pipName
string
)
error
{
glog
.
V
(
2
)
.
Infof
(
"ensure(%s): pip(%s) - deleting"
,
serviceName
,
pipName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
deleteErr
:=
az
.
PublicIPAddressesClient
.
Delete
(
az
.
ResourceGroup
,
pipName
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
deleteErr
)
{
glog
.
V
(
2
)
.
Infof
(
"ensure(%s) backing off: pip(%s) - deleting"
,
serviceName
,
pipName
)
...
...
@@ -910,6 +917,7 @@ func (az *Cloud) ensureHostInPool(serviceName string, nodeName types.NodeName, b
primaryIPConfig
.
LoadBalancerBackendAddressPools
=
&
newBackendPools
glog
.
V
(
3
)
.
Infof
(
"nicupdate(%s): nic(%s) - updating"
,
serviceName
,
nicName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
InterfacesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
*
nic
.
Name
,
nic
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"nicupdate(%s) backing off: nic(%s) - updating, err=%v"
,
serviceName
,
nicName
,
err
)
...
...
pkg/cloudprovider/providers/azure/azure_routes.go
View file @
6d73a09d
...
...
@@ -77,6 +77,7 @@ func (az *Cloud) CreateRoute(clusterName string, nameHint string, kubeRoute *clo
}
glog
.
V
(
3
)
.
Infof
(
"create: creating routetable. routeTableName=%q"
,
az
.
RouteTableName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
RouteTablesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
az
.
RouteTableName
,
routeTable
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"create backing off: creating routetable. routeTableName=%q"
,
az
.
RouteTableName
)
...
...
@@ -112,6 +113,7 @@ 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
()
resp
,
err
:=
az
.
RoutesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
az
.
RouteTableName
,
*
route
.
Name
,
route
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"create backing off: creating route: instance=%q cidr=%q"
,
kubeRoute
.
TargetNode
,
kubeRoute
.
DestinationCIDR
)
...
...
@@ -135,6 +137,7 @@ 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
()
resp
,
err
:=
az
.
RoutesClient
.
Delete
(
az
.
ResourceGroup
,
az
.
RouteTableName
,
routeName
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"delete backing off: deleting route. clusterName=%q instance=%q cidr=%q"
,
clusterName
,
kubeRoute
.
TargetNode
,
kubeRoute
.
DestinationCIDR
)
...
...
pkg/cloudprovider/providers/azure/azure_storage.go
View file @
6d73a09d
...
...
@@ -65,6 +65,7 @@ func (az *Cloud) AttachDisk(diskName, diskURI string, nodeName types.NodeName, l
}
vmName
:=
mapNodeNameToVMName
(
nodeName
)
glog
.
V
(
2
)
.
Infof
(
"create(%s): vm(%s)"
,
az
.
ResourceGroup
,
vmName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
VirtualMachinesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
vmName
,
newVM
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"create(%s) backing off: vm(%s)"
,
az
.
ResourceGroup
,
vmName
)
...
...
@@ -145,6 +146,7 @@ func (az *Cloud) DetachDiskByName(diskName, diskURI string, nodeName types.NodeN
}
vmName
:=
mapNodeNameToVMName
(
nodeName
)
glog
.
V
(
2
)
.
Infof
(
"create(%s): vm(%s)"
,
az
.
ResourceGroup
,
vmName
)
az
.
operationPollRateLimiter
.
Accept
()
resp
,
err
:=
az
.
VirtualMachinesClient
.
CreateOrUpdate
(
az
.
ResourceGroup
,
vmName
,
newVM
,
nil
)
if
az
.
CloudProviderBackoff
&&
shouldRetryAPIRequest
(
resp
,
err
)
{
glog
.
V
(
2
)
.
Infof
(
"create(%s) backing off: vm(%s)"
,
az
.
ResourceGroup
,
vmName
)
...
...
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