Skip to content

Commit 9448b87

Browse files
author
Rahul Sharma
committed
fix lint errors
1 parent d9b1313 commit 9448b87

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

internal/controller/linodemachine_controller_helpers.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import (
5757
const (
5858
maxBootstrapDataBytesCloudInit = 16384
5959
vlanIPFormat = "%s/11"
60+
ipv6Range = "/64" // Default IPv6 range for VPC interfaces
6061
)
6162

6263
var (
@@ -497,7 +498,7 @@ func getVPCInterfaceConfig(ctx context.Context, machineScope *scope.MachineScope
497498
IPv6: &linodego.InstanceConfigInterfaceCreateOptionsIPv6{
498499
Ranges: []linodego.InstanceConfigInterfaceCreateOptionsIPv6Range{
499500
{
500-
Range: ptr.To("/64"),
501+
Range: ptr.To(ipv6Range),
501502
},
502503
},
503504
},
@@ -556,6 +557,13 @@ func getVPCInterfaceConfigFromDirectID(ctx context.Context, machineScope *scope.
556557
IPv4: &linodego.VPCIPv4{
557558
NAT1To1: ptr.To("any"),
558559
},
560+
IPv6: &linodego.InstanceConfigInterfaceCreateOptionsIPv6{
561+
Ranges: []linodego.InstanceConfigInterfaceCreateOptionsIPv6Range{
562+
{
563+
Range: ptr.To(ipv6Range),
564+
},
565+
},
566+
},
559567
}, nil
560568
}
561569

internal/webhook/v1alpha2/linodevpc_webhook.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ func (r *linodeVPCValidator) validateLinodeVPCSubnets(spec infrav1alpha2.LinodeV
182182
labels = []string{}
183183
)
184184

185-
for i, subnet := range spec.Subnets {
185+
for idx, subnet := range spec.Subnets {
186186
var (
187187
label = subnet.Label
188-
labelPath = field.NewPath("spec").Child("Subnets").Index(i).Child("Label")
188+
labelPath = field.NewPath("spec").Child("Subnets").Index(idx).Child("Label")
189189
ip = subnet.IPv4
190-
ipPath = field.NewPath("spec").Child("Subnets").Index(i).Child("IPv4")
190+
ipPath = field.NewPath("spec").Child("Subnets").Index(idx).Child("IPv4")
191191
ipv6Range = subnet.IPv6Range
192-
ipv6RangePath = field.NewPath("spec").Child("Subnets").Index(i).Child("IPv6Range")
192+
ipv6RangePath = field.NewPath("spec").Child("Subnets").Index(idx).Child("IPv6Range")
193193
)
194194

195195
// Validate Subnet Label
@@ -304,7 +304,7 @@ func validateSubnetIPv4CIDR(cidr string, path *field.Path) (*netipx.IPSet, *fiel
304304

305305
func validateIPv6Range(ipv6Range string, path *field.Path) *field.Error {
306306
var errs = []error{
307-
errors.New("IPv6 range must start with /. Example: /64"),
307+
errors.New("IPv6 range must start with /. Example: /52"),
308308
errors.New("IPv6 range doesn't contain a valid number after /"),
309309
errors.New("IPv6 range must be between /0 and /128"),
310310
}

0 commit comments

Comments
 (0)