Skip to content

Commit c461a1f

Browse files
committed
fix review comments
1 parent 1ff08ff commit c461a1f

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

cloud/linode/loadbalancers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var (
6161
string(linodego.AlgorithmRingHash): true,
6262
string(linodego.AlgorithmLeastConn): true,
6363
}
64-
// validTCPStickiness is a map of valid HTTP stickiness options
64+
// validHTTPStickiness is a map of valid HTTP stickiness options
6565
validHTTPStickiness = map[string]bool{
6666
string(linodego.StickinessNone): true,
6767
string(linodego.StickinessHTTPCookie): true,

cloud/linode/loadbalancers_helpers.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import (
1111
"github.com/linode/linode-cloud-controller-manager/cloud/annotations"
1212
)
1313

14+
const (
15+
udpCheckPortDefault = 80
16+
udpCheckPortMin = 1
17+
udpCheckPortMax = 65535
18+
)
19+
1420
// getPortProtocol returns the protocol for a given service port.
1521
// It checks the portConfigAnnotationResult for a specific port.
1622
// If not found, it checks the service annotations for the service.
@@ -94,7 +100,7 @@ func getPortAlgorithm(portConfigAnnotationResult portConfigAnnotation, service *
94100
// If not found, it checks the service annotations for the service.
95101
// It also validates the UDP check port against a range of valid ports (1-65535).
96102
func getPortUDPCheckPort(portConfigAnnotationResult portConfigAnnotation, service *v1.Service, protocol linodego.ConfigProtocol) (int, error) {
97-
udpCheckPort := 80
103+
udpCheckPort := udpCheckPortDefault
98104
if protocol != linodego.ProtocolUDP {
99105
return udpCheckPort, nil
100106
}
@@ -114,7 +120,7 @@ func getPortUDPCheckPort(portConfigAnnotationResult portConfigAnnotation, servic
114120
}
115121

116122
// Validate the UDP check port to be between 1 and 65535
117-
if udpCheckPort < 1 || udpCheckPort > 65535 {
123+
if udpCheckPort < udpCheckPortMin || udpCheckPort > udpCheckPortMax {
118124
return udpCheckPort, fmt.Errorf("UDPCheckPort must be between 1 and 65535, got %d", udpCheckPort)
119125
}
120126
return udpCheckPort, nil

docs/configuration/annotations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ The keys and the values in [annotations must be strings](https://kubernetes.io/d
2121
| `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 |
2222
| `default-protocol` | `tcp`, `udp`, `http`, `https` | `tcp` | This annotation is used to specify the default protocol for Linode NodeBalancer |
2323
| `default-proxy-protocol` | `none`, `v1`, `v2` | `none` | Specifies whether to use a version of Proxy Protocol on the underlying NodeBalancer |
24-
| `default-algorithm` | `roundrobin`, `leastconn`, `source`, `ring_hash` | `roundrobin` | This annotation is used to specify the default alogrithm for Linode NodeBalancer |
25-
| `default-stickiness` | `none`, `session`, `table`, `http_cookie`, `source_ip` | `session` UDP, `table` HTTP/HTTPs | This annotation is used to specify the default stickiness for Linode NodeBalancer |
24+
| `default-algorithm` | `roundrobin`, `leastconn`, `source`, `ring_hash` | `roundrobin` | This annotation is used to specify the default algorithm for Linode NodeBalancer |
25+
| `default-stickiness` | `none`, `session`, `table`, `http_cookie`, `source_ip` | `session` (for UDP), `table` (for HTTP/HTTPs) | This annotation is used to specify the default stickiness for Linode NodeBalancer |
2626
| `port-*` | json object | | Specifies port specific NodeBalancer configuration. See [Port Configuration](#port-specific-configuration) |
2727
| `check-type` | `none`, `connection`, `http`, `http_body` | `none` for UDP, else `connection` | The type of health check to perform against back-ends. See [Health Checks](loadbalancer.md#health-checks) |
2828
| `check-path` | string | | The URL path to check on each back-end during health checks |
@@ -57,7 +57,7 @@ metadata:
5757
"tls-secret-name": "my-tls-secret",
5858
"proxy-protocol": "v2",
5959
"algorithm": "leastconn",
60-
"stickiness": "http_cookie",
60+
"stickiness": "http_cookie"
6161
}
6262
```
6363

e2e/test/lb-with-udp-ports/chainsaw-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ spec:
5555
port_7070_timeout=$(echo $nbconfig | jq '.check_timeout == 3')
5656
port_7070_attempts=$(echo $nbconfig | jq '.check_attempts == 2')
5757
port_7070_protocol=$(echo $nbconfig | jq '.protocol == "udp"')
58-
#port_7070_up_nodes=$(echo $nbconfig | jq '(.nodes_status.up)|tonumber >= 2')
59-
# Placeholder for the actual check until we have the support
58+
# TODO: Implement the actual check for UDP node health when support is added
59+
# port_7070_up_nodes=$(echo $nbconfig | jq '(.nodes_status.up)|tonumber >= 2')
6060
port_7070_up_nodes="true"
6161
6262
if [[ $port_7070_check == "true" && $port_7070_interval == "true" && $port_7070_timeout == "true" && $port_7070_attempts == "true" && $port_7070_protocol == "true" && $port_7070_up_nodes == "true" ]]; then

0 commit comments

Comments
 (0)