Skip to content

Commit 3e45ba9

Browse files
committed
add support for new network interfaces on LinodeMachines
1 parent 6e6db1b commit 3e45ba9

14 files changed

+3026
-127
lines changed

api/v1alpha2/linodemachine_types.go

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ type LinodeMachineSpec struct {
6262
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
6363
Interfaces []InstanceConfigInterfaceCreateOptions `json:"interfaces,omitempty"`
6464
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
65+
// +kubebuilder:object:generate=true
66+
LinodeInterfaces []LinodeInterfaceCreateOptions `json:"linodeInterfaces,omitempty"`
67+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
6568
BackupsEnabled bool `json:"backupsEnabled,omitempty"`
6669
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
6770
PrivateIP *bool `json:"privateIP,omitempty"`
@@ -194,6 +197,96 @@ type InstanceConfigInterfaceCreateOptions struct {
194197
IPRanges []string `json:"ipRanges,omitempty"`
195198
}
196199

200+
// LinodeInterfaceCreateOptions defines the linode network interface config
201+
type LinodeInterfaceCreateOptions struct {
202+
FirewallID *int `json:"firewall_id,omitempty"`
203+
DefaultRoute *InterfaceDefaultRoute `json:"default_route,omitempty"`
204+
Public *PublicInterfaceCreateOptions `json:"public,omitempty"`
205+
VPC *VPCInterfaceCreateOptions `json:"vpc,omitempty"`
206+
VLAN *VLANInterface `json:"vlan,omitempty"`
207+
}
208+
209+
// InterfaceDefaultRoute defines the default IPv4 and IPv6 routes for an interface
210+
type InterfaceDefaultRoute struct {
211+
IPv4 *bool `json:"ipv4,omitempty"`
212+
IPv6 *bool `json:"ipv6,omitempty"`
213+
}
214+
215+
// PublicInterfaceCreateOptions defines the IPv4 and IPv6 public interface create options
216+
type PublicInterfaceCreateOptions struct {
217+
IPv4 *PublicInterfaceIPv4CreateOptions `json:"ipv4,omitempty"`
218+
IPv6 *PublicInterfaceIPv6CreateOptions `json:"ipv6,omitempty"`
219+
}
220+
221+
// PublicInterfaceIPv4CreateOptions defines the PublicInterfaceIPv4AddressCreateOptions for addresses
222+
type PublicInterfaceIPv4CreateOptions struct {
223+
Addresses []PublicInterfaceIPv4AddressCreateOptions `json:"addresses,omitempty"`
224+
}
225+
226+
// PublicInterfaceIPv4AddressCreateOptions defines the public IPv4 address and whether it is primary
227+
type PublicInterfaceIPv4AddressCreateOptions struct {
228+
Address string `json:"address"`
229+
Primary *bool `json:"primary,omitempty"`
230+
}
231+
232+
// PublicInterfaceIPv6CreateOptions defines the PublicInterfaceIPv6RangeCreateOptions
233+
type PublicInterfaceIPv6CreateOptions struct {
234+
Ranges []PublicInterfaceIPv6RangeCreateOptions `json:"ranges,omitempty"`
235+
}
236+
237+
// PublicInterfaceIPv6RangeCreateOptions defines the IPv6 range for a public interface
238+
type PublicInterfaceIPv6RangeCreateOptions struct {
239+
Range string `json:"range"`
240+
}
241+
242+
// VPCInterfaceCreateOptions defines the VPC interface configuration for an instance
243+
type VPCInterfaceCreateOptions struct {
244+
SubnetID int `json:"subnet_id"`
245+
IPv4 *VPCInterfaceIPv4CreateOptions `json:"ipv4,omitempty"`
246+
IPv6 *VPCInterfaceIPv6CreateOptions `json:"ipv6,omitempty"`
247+
}
248+
249+
// VPCInterfaceIPv6CreateOptions defines the IPv6 configuration for a VPC interface
250+
type VPCInterfaceIPv6CreateOptions struct {
251+
SLAAC []VPCInterfaceIPv6SLAACCreateOptions `json:"slaac,omitempty"`
252+
Ranges []VPCInterfaceIPv6RangeCreateOptions `json:"ranges,omitempty"`
253+
IsPublic bool `json:"is_public"`
254+
}
255+
256+
// VPCInterfaceIPv6SLAACCreateOptions defines the Range for IPv6 SLAAC
257+
type VPCInterfaceIPv6SLAACCreateOptions struct {
258+
Range string `json:"range"`
259+
}
260+
261+
// VPCInterfaceIPv6RangeCreateOptions defines the IPv6 range for a VPC interface
262+
type VPCInterfaceIPv6RangeCreateOptions struct {
263+
Range string `json:"range"`
264+
}
265+
266+
// VPCInterfaceIPv4CreateOptions defines the IPv4 address and range configuration for a VPC interface
267+
type VPCInterfaceIPv4CreateOptions struct {
268+
Addresses []VPCInterfaceIPv4AddressCreateOptions `json:"addresses,omitempty"`
269+
Ranges []VPCInterfaceIPv4RangeCreateOptions `json:"ranges,omitempty"`
270+
}
271+
272+
// VPCInterfaceIPv4AddressCreateOptions defines the IPv4 configuration for a VPC interface
273+
type VPCInterfaceIPv4AddressCreateOptions struct {
274+
Address string `json:"address"`
275+
Primary *bool `json:"primary,omitempty"`
276+
NAT1To1Address *string `json:"nat_1_1_address,omitempty"`
277+
}
278+
279+
// VPCInterfaceIPv4RangeCreateOptions defines the IPv4 range for a VPC interface
280+
type VPCInterfaceIPv4RangeCreateOptions struct {
281+
Range string `json:"range"`
282+
}
283+
284+
// VLANInterface defines the VLAN interface configuration for an instance
285+
type VLANInterface struct {
286+
VLANLabel string `json:"vlan_label"`
287+
IPAMAddress *string `json:"ipam_address,omitempty"`
288+
}
289+
197290
// VPCIPv4 defines VPC IPV4 settings
198291
type VPCIPv4 struct {
199292
VPC string `json:"vpc,omitempty"`

0 commit comments

Comments
 (0)