@@ -3,6 +3,7 @@ package linode
33import (
44 "context"
55 "fmt"
6+ "net"
67 "os"
78 "strconv"
89 "strings"
@@ -19,6 +20,8 @@ import (
1920 "github.com/linode/linode-cloud-controller-manager/cloud/linode/client"
2021)
2122
23+ var ipv6ConfiguredRoutes []* cloudprovider.Route
24+
2225type routeCache struct {
2326 Mu sync.RWMutex
2427 routes map [int ][]linodego.VPCIP
@@ -128,6 +131,17 @@ func (r *routes) getInstanceFromName(ctx context.Context, name string) (*linodeg
128131
129132// CreateRoute adds route's subnet to ip_ranges of target node's VPC interface
130133func (r * routes ) CreateRoute (ctx context.Context , clusterName string , nameHint string , route * cloudprovider.Route ) error {
134+ // ignore IPv6 CIDRs but make sure something gets assigned to them to avoid errors
135+ ipAddr , _ , err := net .ParseCIDR (route .DestinationCIDR )
136+ if err != nil {
137+ return err
138+ }
139+ if ipAddr .To4 () == nil {
140+ // "configure" the route so route controller doesn't keep creating it
141+ ipv6ConfiguredRoutes = append (ipv6ConfiguredRoutes , route )
142+ return nil
143+ }
144+
131145 instance , err := r .getInstanceFromName (ctx , string (route .TargetNode ))
132146 if err != nil {
133147 return err
@@ -272,5 +286,9 @@ func (r *routes) ListRoutes(ctx context.Context, clusterName string) ([]*cloudpr
272286 }
273287 }
274288 }
289+
290+ // add in "configured" IPv6 routes so cloud-provider is happy
291+ configuredRoutes = append (configuredRoutes , ipv6ConfiguredRoutes ... )
292+
275293 return configuredRoutes , nil
276294}
0 commit comments