Skip to content

Commit 360f3f3

Browse files
committed
configure default client-side throttle for ELBv2 APIs
1 parent bdb42ea commit 360f3f3

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

docs/deploy/configurations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ Once disabled:
129129

130130
### throttle config
131131

132-
The default throttle config used is.
132+
Controller uses the following default throttle config:
133133

134134
```
135-
WAF Regional:^AssociateWebACL|DisassociateWebACL=0.5:1,WAF Regional:^GetWebACLForResource|ListResourcesForWebACL=1:1,WAFV2:^AssociateWebACL|DisassociateWebACL=0.5:1,WAFV2:^GetWebACLForResource|ListResourcesForWebACL=1:1
135+
WAF Regional:^AssociateWebACL|DisassociateWebACL=0.5:1,WAF Regional:^GetWebACLForResource|ListResourcesForWebACL=1:1,WAFV2:^AssociateWebACL|DisassociateWebACL=0.5:1,WAFV2:^GetWebACLForResource|ListResourcesForWebACL=1:1,Elastic Load Balancing v2:^RegisterTargets|^DeregisterTargets=4:20,Elastic Load Balancing v2:.*=10:40
136136
```
137137
Client side throttling enables gradual scaling of the api calls. Additional throttle config can be specified via the `--aws-api-throttle` flag. You can get the ServiceID from the API definition in AWS SDK. For e.g, ELBv2 it is [Elastic Load Balancing v2](https://github.com/aws/aws-sdk-go/blob/main/models/apis/elasticloadbalancingv2/2015-12-01/api-2.json#L9).
138138

pkg/aws/throttle/defaults.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package throttle
22

33
import (
4+
"github.com/aws/aws-sdk-go/service/elbv2"
45
"github.com/aws/aws-sdk-go/service/wafregional"
56
"github.com/aws/aws-sdk-go/service/wafv2"
67
"golang.org/x/time/rate"
@@ -35,6 +36,18 @@ func NewDefaultServiceOperationsThrottleConfig() *ServiceOperationsThrottleConfi
3536
burst: 1,
3637
},
3738
},
39+
elbv2.ServiceID: {
40+
{
41+
operationPtn: regexp.MustCompile("^RegisterTargets|^DeregisterTargets"),
42+
r: rate.Limit(4),
43+
burst: 20,
44+
},
45+
{
46+
operationPtn: regexp.MustCompile(".*"),
47+
r: rate.Limit(10),
48+
burst: 40,
49+
},
50+
},
3851
},
3952
}
4053
}

pkg/ingress/group_loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (m *defaultGroupLoader) checkGroupMembershipType(ctx context.Context, group
152152
}
153153
return groupMembershipTypeNone, ClassifiedIngress{}, nil
154154
}
155-
155+
156156
// tolerate errInvalidIngressGroup error since an Ingress with a wrong IngressGroup name means to leave the IngressGroup anyway.
157157
if errors.Is(err, errInvalidIngressGroup) {
158158
if hasGroupFinalizer {

0 commit comments

Comments
 (0)