-
Notifications
You must be signed in to change notification settings - Fork 109
TPT-4463: Support RDMA VPC interfaces #988
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
Changes from all commits
e38a399
096e5fe
3e80244
9caa537
cc14325
85c500d
9e67fb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,11 @@ type LinodeInterface struct { | |
| Public *PublicInterface `json:"public"` | ||
| VPC *VPCInterface `json:"vpc"` | ||
| VLAN *VLANInterface `json:"vlan"` | ||
|
|
||
| // RDMAVPC contains the configuration for an RDMA VPC interface attached | ||
| // to a GPUDirect RDMA capable Linode. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| RDMAVPC *RDMAVPCInterface `json:"rdma_vpc"` | ||
| } | ||
|
|
||
| type InterfaceDefaultRoute struct { | ||
|
|
@@ -111,6 +116,29 @@ type VLANInterface struct { | |
| IPAMAddress *string `json:"ipam_address,omitempty"` | ||
| } | ||
|
|
||
| // RDMAVPCInterface contains information about an RDMA VPC interface attached | ||
| // to a GPUDirect RDMA capable Linode. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| type RDMAVPCInterface struct { | ||
| VPCID int `json:"vpc_id"` | ||
| SubnetID int `json:"subnet_id"` | ||
| IPv4 RDMAVPCInterfaceIPv4 `json:"ipv4"` | ||
| } | ||
|
|
||
| // RDMAVPCInterfaceIPv4 contains the IPv4 configuration for an RDMA VPC interface. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| type RDMAVPCInterfaceIPv4 struct { | ||
| Addresses []RDMAVPCInterfaceIPv4Address `json:"addresses"` | ||
| } | ||
|
|
||
| // RDMAVPCInterfaceIPv4Address represents a single IPv4 address assigned to an | ||
| // RDMA VPC interface. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| type RDMAVPCInterfaceIPv4Address struct { | ||
| Address string `json:"address"` | ||
| Primary bool `json:"primary"` | ||
| } | ||
|
|
||
| type LinodeInterfaceCreateOptions struct { | ||
| FirewallID *int `json:"firewall_id,omitempty"` | ||
| DefaultRoute *InterfaceDefaultRoute `json:"default_route,omitempty"` | ||
|
|
@@ -119,10 +147,27 @@ type LinodeInterfaceCreateOptions struct { | |
| VLAN *VLANInterface `json:"vlan,omitempty"` | ||
| } | ||
|
|
||
| // LinodeInstanceInterfaceCreateOptions specifies a Linode Interface to be | ||
| // created as part of a Linode creation request with RDMA VPC options available. | ||
| // | ||
| // The standalone interface create endpoint does NOT accept RDMA VPC | ||
| // interfaces and therefore continues to use LinodeInterfaceCreateOptions. | ||
| type LinodeInstanceInterfaceCreateOptions struct { | ||
| LinodeInterfaceCreateOptions | ||
|
|
||
| // RDMAVPC creates an RDMA VPC interface attached to the new Linode. | ||
| // Only one of Public, VPC, VLAN or RDMAVPC may be set per interface. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| RDMAVPC *RDMAVPCInterfaceCreateOptions `json:"rdma_vpc,omitzero"` | ||
| } | ||
|
|
||
| type LinodeInterfaceUpdateOptions struct { | ||
| DefaultRoute *InterfaceDefaultRoute `json:"default_route,omitempty"` | ||
| Public *PublicInterfaceCreateOptions `json:"public,omitempty"` | ||
| VPC *VPCInterfaceUpdateOptions `json:"vpc,omitempty"` | ||
|
|
||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| RDMAVPC *RDMAVPCInterfaceUpdateOptions `json:"rdma_vpc,omitzero"` | ||
| } | ||
|
|
||
| type PublicInterfaceCreateOptions struct { | ||
|
|
@@ -193,6 +238,37 @@ type VPCInterfaceUpdateOptions struct { | |
| IPv6 *VPCInterfaceIPv6CreateOptions `json:"ipv6,omitempty"` | ||
| } | ||
|
|
||
| // RDMAVPCInterfaceCreateOptions specifies parameters for creating an RDMA VPC | ||
| // interface as part of a Linode creation. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| type RDMAVPCInterfaceCreateOptions struct { | ||
| SubnetID int `json:"subnet_id"` | ||
| IPv4 RDMAVPCInterfaceIPv4Options `json:"ipv4,omitzero"` | ||
| } | ||
|
|
||
| // RDMAVPCInterfaceUpdateOptions specifies the mutable fields of an RDMA VPC | ||
| // interface. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| type RDMAVPCInterfaceUpdateOptions struct { | ||
| SubnetID int `json:"subnet_id,omitzero"` | ||
| IPv4 RDMAVPCInterfaceIPv4Options `json:"ipv4,omitzero"` | ||
| } | ||
|
|
||
| // RDMAVPCInterfaceIPv4Options specifies IPv4 parameters for an RDMA VPC | ||
| // interface. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| type RDMAVPCInterfaceIPv4Options struct { | ||
| Addresses []RDMAVPCInterfaceIPv4AddressOptions `json:"addresses,omitzero"` | ||
| } | ||
|
|
||
| // RDMAVPCInterfaceIPv4AddressOptions represents a single IPv4 address | ||
| // configuration for an RDMA VPC interface. | ||
| // NOTE: RDMA VPC interfaces may not currently be available to all users. | ||
| type RDMAVPCInterfaceIPv4AddressOptions struct { | ||
| Address string `json:"address,omitzero"` | ||
| Primary *bool `json:"primary,omitzero"` | ||
| } | ||
|
yec-akamai marked this conversation as resolved.
|
||
|
|
||
| type LinodeInterfacesUpgrade struct { | ||
| ConfigID int `json:"config_id"` | ||
| DryRun bool `json:"dry_run"` | ||
|
|
@@ -248,9 +324,17 @@ func (i *LinodeInterface) UnmarshalJSON(b []byte) error { | |
| return nil | ||
| } | ||
|
|
||
| func (c *Client) ListInterfaces(ctx context.Context, linodeID int, opts *ListOptions) ([]LinodeInterface, error) { | ||
| func (c *Client) ListInterfaces(ctx context.Context, linodeID int, _ *ListOptions) ([]LinodeInterface, error) { | ||
| e := formatAPIPath("linode/instances/%d/interfaces", linodeID) | ||
| return getPaginatedResults[LinodeInterface](ctx, c, e, opts) | ||
|
|
||
| response, err := doGETRequest[struct { | ||
| Interfaces []LinodeInterface `json:"interfaces"` | ||
| }](ctx, c, e) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return response.Interfaces, nil | ||
|
Contributor
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. Shouldn't we keep filtering of the results here (then
Contributor
Author
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. The result is not paginated, and API does not seem to accept filter either. |
||
| } | ||
|
|
||
| func (c *Client) GetInterface(ctx context.Context, linodeID int, interfaceID int) (*LinodeInterface, error) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "id": 10, | ||
| "mac_address": "22:00:f2:9e:d3:48", | ||
| "created": "2026-03-12T09:54:34", | ||
| "updated": "2026-03-12T09:54:35", | ||
| "default_route": { | ||
| "ipv4": false, | ||
| "ipv6": false | ||
| }, | ||
| "version": 1, | ||
| "public": null, | ||
| "vpc": null, | ||
| "vlan": null, | ||
| "rdma_vpc": { | ||
| "vpc_id": 7, | ||
| "subnet_id": 8, | ||
| "ipv4": { | ||
| "addresses": [ | ||
| { | ||
| "address": "10.0.0.2", | ||
| "primary": true | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,90 +1,57 @@ | ||
| { | ||
| "data": [ | ||
| "interfaces": [ | ||
| { | ||
| "id": 123, | ||
| "mac_address": "22:00:AB:CD:EF:01", | ||
| "created": "2024-01-01T00:01:01", | ||
| "updated": "2024-01-01T00:01:01", | ||
| "default_route": { | ||
| "ipv4": false, | ||
| "ipv6": false | ||
| }, | ||
| "version": 1, | ||
| "vpc": null, | ||
| "public": null, | ||
| "vlan": { | ||
| "vlan_label": "my_vlan", | ||
| "ipam_address": "10.0.0.1/24" | ||
| } | ||
| }, | ||
| { | ||
| "id": 456, | ||
| "mac_address": "22:00:AB:CD:EF:01", | ||
| "created": "2024-01-01T00:01:01", | ||
| "updated": "2024-01-01T00:01:01", | ||
| "created": "2025-01-01T00:01:01", | ||
| "default_route": { | ||
| "ipv4": true, | ||
| "ipv6": true | ||
| }, | ||
| "version": 1, | ||
| "vpc": { | ||
| "vpc_id": 123456, | ||
| "subnet_id": 789, | ||
| "ipv4" : { | ||
| "id": 1234, | ||
| "mac_address": "22:00:AB:CD:EF:01", | ||
| "public": { | ||
| "ipv4": { | ||
| "addresses": [ | ||
| { | ||
| "address": "192.168.22.3", | ||
| "address": "172.30.0.50", | ||
| "primary": true | ||
| } | ||
| ], | ||
| "ranges": [ | ||
| { "range": "192.168.22.16/28"}, | ||
| { "range": "192.168.22.32/28"} | ||
| "shared": [ | ||
| { | ||
| "address": "172.30.0.51", | ||
| "linode_id": 12345 | ||
| } | ||
| ] | ||
| }, | ||
| "ipv6": { | ||
| "slaac": [ | ||
| "ranges": [ | ||
| { | ||
| "range": "1234::/64", | ||
| "address": "1234::5678" | ||
| "range": "2001:DB8::/64", | ||
| "route_target": "2001:db8:1383:b8dc:33c5:fe0b:c9fa:4e9e" | ||
| }, | ||
| { | ||
| "range": "2001:DB8::/64", | ||
| "route_target": "2001:db8:dffd:2d09:7aea:176d:17e5:80f5" | ||
| } | ||
| ], | ||
| "ranges": [ | ||
| "shared": [ | ||
| { | ||
| "range": "4321::/64" | ||
| "range": "2001:DB8::/64", | ||
| "route_target": null | ||
| } | ||
| ], | ||
| "is_public": true | ||
| } | ||
| }, | ||
| "public": null, | ||
| "vlan": null | ||
| }, | ||
| { | ||
| "id": 789, | ||
| "mac_address": "22:00:AB:CD:EF:01", | ||
| "created": "2024-01-01T00:01:01", | ||
| "updated": "2024-01-01T00:01:01", | ||
| "default_route": { | ||
| "ipv4": false, | ||
| "ipv6": false | ||
| }, | ||
| "version": 1, | ||
| "vpc": null, | ||
| "public": { | ||
| "ipv4": { | ||
| "addresses": [ | ||
| "slaac": [ | ||
| { | ||
| "address": "auto", | ||
| "primary": true | ||
| "address": "2001:db8:5f09:12d6:e014:e11a:aca2:cfa3", | ||
| "prefix": 64 | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "vlan": null | ||
| "updated": "2025-01-01T00:01:01", | ||
| "version": 1, | ||
| "vlan": null, | ||
| "vpc": null | ||
| } | ||
| ], | ||
| "page": 1, | ||
| "pages": 1, | ||
| "results": 3 | ||
| } | ||
| ] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.