Repository: linode/linode-cloud-controller-manager
Pull request #189 (2024-03-13 22:44:45)

disable conn-throttle by default
### General:

* [ ] Have you removed all sensitive information, including but not limited to access keys and passwords?
* [ ] Have you checked to ensure there aren't other open or closed [Pull Requests](../../pulls) for the same bug/feature/question?

### Pull Request Guidelines:

1. [ ] Does your submission pass tests?
1. [ ] Have you added tests? 
1. [ ] Are you addressing a single feature in this PR? 
1. [ ] Are your commits atomic, addressing one change per commit?
1. [ ] Are you following the conventions of the language? 
1. [ ] Have you saved your large formatting changes for a different PR, so we can focus on your work?
1. [ ] Have you explained your rationale for why this feature is needed? 
1. [ ] Have you linked your PR to an [open issue](https://blog.github.com/2013-05-14-closing-issues-via-pull-requests/)




Patch:
diff --git a/README.md b/README.md
index b18e4dc..1c91de3 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@ Each *Service* annotation **MUST** be prefixed with:<br />
 
 Annotation (Suffix) | Values | Default | Description
 ---|---|---|---
-`throttle` | `0`-`20` (`0` to disable) | `20` | Client Connection Throttle, which limits the number of subsequent new connections per second from the same client IP
+`throttle` | `0`-`20` (`0` to disable) | `0` | Client Connection Throttle, which limits the number of subsequent new connections per second from the same client IP
 `default-protocol` | `tcp`, `http`, `https` | `tcp` | This annotation is used to specify the default protocol for Linode NodeBalancer.
 `default-proxy-protocol` | `none`, `v1`, `v2` | `none` | Specifies whether to use a version of Proxy Protocol on the underlying NodeBalancer.
 `port-*` | json (e.g. `{ "tls-secret-name": "prod-app-tls", "protocol": "https", "proxy-protocol": "v2"}`) | | Specifies port specific NodeBalancer configuration. See [Port Specific Configuration](#port-specific-configuration). `*` is the port being configured, e.g. `linode-loadbalancer-port-443`
diff --git a/cloud/linode/loadbalancers.go b/cloud/linode/loadbalancers.go
index a661c60..dd989b7 100644
--- a/cloud/linode/loadbalancers.go
+++ b/cloud/linode/loadbalancers.go
@@ -825,7 +825,7 @@ func getTLSCertInfo(ctx context.Context, kubeClient kubernetes.Interface, namesp
 }
 
 func getConnectionThrottle(service *v1.Service) int {
-	connThrottle := 20
+	connThrottle := 0 // disable throttle if nothing is specified
 
 	if connThrottleString := service.GetAnnotations()[annotations.AnnLinodeThrottle]; connThrottleString != "" {
 		parsed, err := strconv.Atoi(connThrottleString)


Test patch:
diff --git a/cloud/linode/loadbalancers_test.go b/cloud/linode/loadbalancers_test.go
index f944bc4..c3222f7 100644
--- a/cloud/linode/loadbalancers_test.go
+++ b/cloud/linode/loadbalancers_test.go
@@ -1818,7 +1818,7 @@ func Test_getConnectionThrottle(t *testing.T) {
 					Annotations: map[string]string{},
 				},
 			},
-			20,
+			0,
 		},
 		{
 			"throttle value is a string",
@@ -1831,7 +1831,7 @@ func Test_getConnectionThrottle(t *testing.T) {
 					},
 				},
 			},
-			20,
+			0,
 		},
 		{
 			"throttle value is less than 0",