Skip to content
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

Add support for virtual network id in origin #1441

Merged
merged 4 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1441.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
load_balancing: Add support for virtual network id in origins
```
3 changes: 3 additions & 0 deletions load_balancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type LoadBalancerOrigin struct {
// weight is used to scale the origin's open connections.
Weight float64 `json:"weight"`
Header map[string][]string `json:"header"`
// The virtual network subnet ID the origin belongs in.
// Virtual network must also belong to the account.
VirtualNetworkID string `json:"virtual_network_id,omitempty"`
}

// LoadBalancerOriginSteering controls origin selection for new sessions and traffic without session affinity.
Expand Down
40 changes: 26 additions & 14 deletions load_balancing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ func TestCreateLoadBalancerPool(t *testing.T) {
"Host": [
"example.com"
]
}
},
"virtual_network_id":"a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
],
"notification_email": "someone@example.com",
Expand Down Expand Up @@ -90,7 +91,8 @@ func TestCreateLoadBalancerPool(t *testing.T) {
"Host": [
"example.com"
]
}
},
"virtual_network_id":"a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
],
"notification_email": "someone@example.com",
Expand Down Expand Up @@ -137,6 +139,7 @@ func TestCreateLoadBalancerPool(t *testing.T) {
Header: map[string][]string{
"Host": {"example.com"},
},
VirtualNetworkID: "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
},
},
NotificationEmail: "someone@example.com",
Expand Down Expand Up @@ -169,6 +172,7 @@ func TestCreateLoadBalancerPool(t *testing.T) {
Header: map[string][]string{
"Host": {"example.com"},
},
VirtualNetworkID: "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
},
},
NotificationEmail: "someone@example.com",
Expand Down Expand Up @@ -286,7 +290,8 @@ func TestListLoadBalancerPools(t *testing.T) {
"name": "app-server-1",
"address": "198.51.100.1",
"enabled": true,
"weight": 1
"weight": 1,
"virtual_network_id":"a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
],
"notification_email": "someone@example.com"
Expand Down Expand Up @@ -318,10 +323,11 @@ func TestListLoadBalancerPools(t *testing.T) {
},
Origins: []LoadBalancerOrigin{
{
Name: "app-server-1",
Address: "198.51.100.1",
Enabled: true,
Weight: 1,
Name: "app-server-1",
Address: "198.51.100.1",
Enabled: true,
Weight: 1,
VirtualNetworkID: "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
},
},
NotificationEmail: "someone@example.com",
Expand Down Expand Up @@ -371,7 +377,8 @@ func TestGetLoadBalancerPool(t *testing.T) {
"name": "app-server-1",
"address": "198.51.100.1",
"enabled": true,
"weight": 1
"weight": 1,
"virtual_network_id":"a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
],
"notification_email": "someone@example.com"
Expand All @@ -395,10 +402,11 @@ func TestGetLoadBalancerPool(t *testing.T) {
},
Origins: []LoadBalancerOrigin{
{
Name: "app-server-1",
Address: "198.51.100.1",
Enabled: true,
Weight: 1,
Name: "app-server-1",
Address: "198.51.100.1",
Enabled: true,
Weight: 1,
VirtualNetworkID: "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
},
},
NotificationEmail: "someone@example.com",
Expand Down Expand Up @@ -483,7 +491,8 @@ func TestUpdateLoadBalancerPool(t *testing.T) {
"Host": [
"example.com"
]
}
},
"virtual_network_id":"a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
],
"notification_email": "nobody@example.com",
Expand Down Expand Up @@ -516,7 +525,8 @@ func TestUpdateLoadBalancerPool(t *testing.T) {
"Host": [
"example.com"
]
}
},
"virtual_network_id":"a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
}
],
"notification_email": "nobody@example.com",
Expand Down Expand Up @@ -549,6 +559,7 @@ func TestUpdateLoadBalancerPool(t *testing.T) {
Header: map[string][]string{
"Host": {"example.com"},
},
VirtualNetworkID: "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
},
},
NotificationEmail: "nobody@example.com",
Expand All @@ -573,6 +584,7 @@ func TestUpdateLoadBalancerPool(t *testing.T) {
Header: map[string][]string{
"Host": {"example.com"},
},
VirtualNetworkID: "a5624d4e-044a-4ff0-b3e1-e2465353d4b4",
},
},
NotificationEmail: "nobody@example.com",
Expand Down
Loading