-
Notifications
You must be signed in to change notification settings - Fork 94
project: UDP NodeBalancers #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ezilber-akamai
wants to merge
5
commits into
main
Choose a base branch
from
proj/nb-udp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b406ec9
Add support for NodeBalancers UDP (#630)
lgarber-akamai 23f7161
Fix merge conflict
lgarber-akamai e0668d8
Merge main into proj/nb-udp
ezilber-akamai 3c8e57c
Merge main into proj/nb-udp
ezilber-akamai 4db3b1f
Updated GetCreateOptions to handle 0 udpCheckPort
ezilber-akamai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,26 +6,28 @@ | |
|
||
// NodeBalancerConfig objects allow a NodeBalancer to accept traffic on a new port | ||
type NodeBalancerConfig struct { | ||
ID int `json:"id"` | ||
Port int `json:"port"` | ||
Protocol ConfigProtocol `json:"protocol"` | ||
ProxyProtocol ConfigProxyProtocol `json:"proxy_protocol"` | ||
Algorithm ConfigAlgorithm `json:"algorithm"` | ||
Stickiness ConfigStickiness `json:"stickiness"` | ||
Check ConfigCheck `json:"check"` | ||
CheckInterval int `json:"check_interval"` | ||
CheckAttempts int `json:"check_attempts"` | ||
CheckPath string `json:"check_path"` | ||
CheckBody string `json:"check_body"` | ||
CheckPassive bool `json:"check_passive"` | ||
CheckTimeout int `json:"check_timeout"` | ||
CipherSuite ConfigCipher `json:"cipher_suite"` | ||
NodeBalancerID int `json:"nodebalancer_id"` | ||
SSLCommonName string `json:"ssl_commonname"` | ||
SSLFingerprint string `json:"ssl_fingerprint"` | ||
SSLCert string `json:"ssl_cert"` | ||
SSLKey string `json:"ssl_key"` | ||
NodesStatus *NodeBalancerNodeStatus `json:"nodes_status"` | ||
ID int `json:"id"` | ||
Port int `json:"port"` | ||
Protocol ConfigProtocol `json:"protocol"` | ||
ProxyProtocol ConfigProxyProtocol `json:"proxy_protocol"` | ||
Algorithm ConfigAlgorithm `json:"algorithm"` | ||
Stickiness ConfigStickiness `json:"stickiness"` | ||
Check ConfigCheck `json:"check"` | ||
CheckInterval int `json:"check_interval"` | ||
CheckAttempts int `json:"check_attempts"` | ||
CheckPath string `json:"check_path"` | ||
CheckBody string `json:"check_body"` | ||
CheckPassive bool `json:"check_passive"` | ||
CheckTimeout int `json:"check_timeout"` | ||
UDPCheckPort int `json:"udp_check_port"` | ||
UDPSessionTimeout int `json:"udp_session_timeout"` | ||
CipherSuite ConfigCipher `json:"cipher_suite"` | ||
NodeBalancerID int `json:"nodebalancer_id"` | ||
SSLCommonName string `json:"ssl_commonname"` | ||
SSLFingerprint string `json:"ssl_fingerprint"` | ||
SSLCert string `json:"ssl_cert"` | ||
SSLKey string `json:"ssl_key"` | ||
NodesStatus *NodeBalancerNodeStatus `json:"nodes_status"` | ||
} | ||
|
||
// ConfigAlgorithm constants start with Algorithm and include Linode API NodeBalancer Config Algorithms | ||
|
@@ -36,6 +38,7 @@ | |
AlgorithmRoundRobin ConfigAlgorithm = "roundrobin" | ||
AlgorithmLeastConn ConfigAlgorithm = "leastconn" | ||
AlgorithmSource ConfigAlgorithm = "source" | ||
AlgorithmRingHash ConfigAlgorithm = "ring_hash" | ||
) | ||
|
||
// ConfigStickiness constants start with Stickiness and include Linode API NodeBalancer Config Stickiness | ||
|
@@ -44,8 +47,10 @@ | |
// ConfigStickiness constants reflect the node stickiness method for a NodeBalancer Config | ||
const ( | ||
StickinessNone ConfigStickiness = "none" | ||
StickinessSession ConfigStickiness = "session" | ||
StickinessTable ConfigStickiness = "table" | ||
StickinessHTTPCookie ConfigStickiness = "http_cookie" | ||
StickinessSourceIP ConfigStickiness = "source_ip" | ||
) | ||
|
||
// ConfigCheck constants start with Check and include Linode API NodeBalancer Config Check methods | ||
|
@@ -67,12 +72,13 @@ | |
ProtocolHTTP ConfigProtocol = "http" | ||
ProtocolHTTPS ConfigProtocol = "https" | ||
ProtocolTCP ConfigProtocol = "tcp" | ||
ProtocolUDP ConfigProtocol = "udp" | ||
) | ||
|
||
// ConfigProxyProtocol constants start with ProxyProtocol and include Linode API NodeBalancer Config proxy protocol versions | ||
type ConfigProxyProtocol string | ||
|
||
// ConfigProxyProtocol constatns reflect the proxy protocol version used by a NodeBalancer Config | ||
// ConfigProxyProtocol constants reflect the proxy protocol version used by a NodeBalancer Config | ||
const ( | ||
ProxyProtocolNone ConfigProxyProtocol = "none" | ||
ProxyProtocolV1 ConfigProxyProtocol = "v1" | ||
|
@@ -108,6 +114,7 @@ | |
CheckBody string `json:"check_body,omitempty"` | ||
CheckPassive *bool `json:"check_passive,omitempty"` | ||
CheckTimeout int `json:"check_timeout,omitempty"` | ||
UDPCheckPort *int `json:"udp_check_port,omitempty"` | ||
CipherSuite ConfigCipher `json:"cipher_suite,omitempty"` | ||
SSLCert string `json:"ssl_cert,omitempty"` | ||
SSLKey string `json:"ssl_key,omitempty"` | ||
|
@@ -128,6 +135,7 @@ | |
CheckBody string `json:"check_body,omitempty"` | ||
CheckPassive *bool `json:"check_passive,omitempty"` | ||
CheckTimeout int `json:"check_timeout,omitempty"` | ||
UDPCheckPort *int `json:"udp_check_port,omitempty"` | ||
CipherSuite ConfigCipher `json:"cipher_suite,omitempty"` | ||
SSLCert string `json:"ssl_cert,omitempty"` | ||
SSLKey string `json:"ssl_key,omitempty"` | ||
|
@@ -147,6 +155,11 @@ | |
|
||
// GetCreateOptions converts a NodeBalancerConfig to NodeBalancerConfigCreateOptions for use in CreateNodeBalancerConfig | ||
func (i NodeBalancerConfig) GetCreateOptions() NodeBalancerConfigCreateOptions { | ||
var udpCheckPort *int = nil | ||
if i.UDPCheckPort != 0 { | ||
udpCheckPort = &i.UDPCheckPort | ||
} | ||
|
||
return NodeBalancerConfigCreateOptions{ | ||
Port: i.Port, | ||
Protocol: i.Protocol, | ||
|
@@ -160,6 +173,7 @@ | |
CheckPath: i.CheckPath, | ||
CheckBody: i.CheckBody, | ||
CheckPassive: copyBool(&i.CheckPassive), | ||
UDPCheckPort: udpCheckPort, | ||
CipherSuite: i.CipherSuite, | ||
SSLCert: i.SSLCert, | ||
SSLKey: i.SSLKey, | ||
|
@@ -181,6 +195,7 @@ | |
CheckBody: i.CheckBody, | ||
CheckPassive: copyBool(&i.CheckPassive), | ||
CheckTimeout: i.CheckTimeout, | ||
UDPCheckPort: copyInt(&i.UDPCheckPort), | ||
CipherSuite: i.CipherSuite, | ||
SSLCert: i.SSLCert, | ||
SSLKey: i.SSLKey, | ||
|
@@ -202,6 +217,7 @@ | |
CheckPath: i.CheckPath, | ||
CheckBody: i.CheckBody, | ||
CheckPassive: copyBool(&i.CheckPassive), | ||
UDPCheckPort: copyInt(&i.UDPCheckPort), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, set only for UDP protocol |
||
CipherSuite: i.CipherSuite, | ||
SSLCert: i.SSLCert, | ||
SSLKey: i.SSLKey, | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, set only for UDP protocol