@@ -57,7 +57,7 @@ func (b infraBuilder) withPlatform(platform configv1.PlatformType) infraBuilder
5757 return b
5858}
5959
60- func (b infraBuilder ) withVSphereNodeNetworking () infraBuilder {
60+ func (b infraBuilder ) withVSphereDefaultNodeNetworking () infraBuilder {
6161 vspereSpecRef := b .platformSpec .VSphere
6262
6363 vspereSpecRef .NodeNetworking .External .Network = "external-network"
@@ -72,6 +72,21 @@ func (b infraBuilder) withVSphereNodeNetworking() infraBuilder {
7272 return b
7373}
7474
75+ func (b infraBuilder ) withVSphereIPv6onlyNodeNetworking () infraBuilder {
76+ vspereSpecRef := b .platformSpec .VSphere
77+
78+ vspereSpecRef .NodeNetworking .External .Network = "external-network"
79+ vspereSpecRef .NodeNetworking .Internal .Network = "internal-network"
80+
81+ vspereSpecRef .NodeNetworking .External .NetworkSubnetCIDR = []string {"fe80::3/128" }
82+ vspereSpecRef .NodeNetworking .External .ExcludeNetworkSubnetCIDR = []string {"fe80::2/128" }
83+
84+ vspereSpecRef .NodeNetworking .Internal .ExcludeNetworkSubnetCIDR = []string {"fe80::1/128" }
85+ vspereSpecRef .NodeNetworking .Internal .NetworkSubnetCIDR = []string {"fe80::4/128" }
86+
87+ return b
88+ }
89+
7590func (b infraBuilder ) withVSphereZones () infraBuilder {
7691 vcenterSpec := configv1.VSpherePlatformVCenterSpec {
7792 Server : "test-server" ,
@@ -139,6 +154,12 @@ func (b infraBuilder) withPrimaryIPv6VIP() infraBuilder {
139154 return b
140155}
141156
157+ func (b infraBuilder ) withIPv6onlyVIP () infraBuilder {
158+ b .platformStatus .VSphere .APIServerInternalIPs = []string {"fd65:a1a8:60ad:271c::200" }
159+ b .platformStatus .VSphere .IngressIPs = []string {"fd65:a1a8:60ad:271c::201" }
160+ return b
161+ }
162+
142163func makeDummyNetworkConfig () * configv1.Network {
143164 return & configv1.Network {}
144165}
@@ -175,6 +196,20 @@ func withDualStackPrimaryIPv6NetworkConfig() *configv1.Network {
175196 }
176197}
177198
199+ func withIPv6onlyNetworkConfig () * configv1.Network {
200+ return & configv1.Network {
201+ Spec : configv1.NetworkSpec {
202+ ClusterNetwork : []configv1.ClusterNetworkEntry {
203+ {CIDR : "fd65:10:128::/56" , HostPrefix : 64 },
204+ },
205+ NetworkType : "OVNKubernetes" ,
206+ ServiceNetwork : []string {
207+ "fd65:172:16::/112" ,
208+ },
209+ },
210+ }
211+ }
212+
178213const iniConfigWithWorkspace = `
179214[Global]
180215secret-name = "vsphere-creds"
@@ -300,6 +335,26 @@ nodes:
300335 excludeInternalNetworkSubnetCidr: 192.0.2.0/24,fe80::1/128,fd65:a1a8:60ad:271c::200/128,192.168.96.3/32,fd65:a1a8:60ad:271c::201/128,192.168.96.4/32,fd69::2/128
301336 excludeExternalNetworkSubnetCidr: 192.1.2.0/24,fe80::2/128,fd65:a1a8:60ad:271c::200/128,192.168.96.3/32,fd65:a1a8:60ad:271c::201/128,192.168.96.4/32,fd69::2/128`
302337
338+ const yamlConfigNodeNetworkingIPv6only = `
339+ global:
340+ insecureFlag: true
341+ secretName: vsphere-creds
342+ secretNamespace: kube-system
343+ vcenter:
344+ test-server:
345+ server: test-server
346+ datacenters:
347+ - DC1
348+ ipFamily:
349+ - ipv6
350+ nodes:
351+ internalNetworkSubnetCidr: fe80::4/128
352+ externalNetworkSubnetCidr: fe80::3/128
353+ internalVmNetworkName: internal-network
354+ externalVmNetworkName: external-network
355+ excludeInternalNetworkSubnetCidr: fe80::1/128,fd65:a1a8:60ad:271c::200/128,fd65:a1a8:60ad:271c::201/128,fd69::2/128
356+ excludeExternalNetworkSubnetCidr: fe80::2/128,fd65:a1a8:60ad:271c::200/128,fd65:a1a8:60ad:271c::201/128,fd69::2/128`
357+
303358const iniConfigZonal = `
304359[Global]
305360secret-name = "vsphere-creds"
@@ -348,7 +403,7 @@ func TestCloudConfigTransformer(t *testing.T) {
348403 },
349404 {
350405 name : "in-tree to external with node networking" ,
351- infraBuilder : newVsphereInfraBuilder ().withVSphereNodeNetworking (),
406+ infraBuilder : newVsphereInfraBuilder ().withVSphereDefaultNodeNetworking (),
352407 networkBuilder : makeDummyNetworkConfig (),
353408 inputConfig : iniConfigWithWorkspace ,
354409 equivalentConfig : iniConfigNodeNetworking ,
@@ -383,14 +438,14 @@ func TestCloudConfigTransformer(t *testing.T) {
383438 },
384439 {
385440 name : "yaml and ini config parsing results should be the same, node networking" ,
386- infraBuilder : newVsphereInfraBuilder ().withVSphereNodeNetworking (),
441+ infraBuilder : newVsphereInfraBuilder ().withVSphereDefaultNodeNetworking (),
387442 networkBuilder : makeDummyNetworkConfig (),
388443 inputConfig : yamlConfigNodeNetworking ,
389444 equivalentConfig : iniConfigNodeNetworking ,
390445 },
391446 {
392447 name : "yaml config should contain node networking if it's specified in infra" ,
393- infraBuilder : newVsphereInfraBuilder ().withVSphereNodeNetworking (),
448+ infraBuilder : newVsphereInfraBuilder ().withVSphereDefaultNodeNetworking (),
394449 networkBuilder : makeDummyNetworkConfig (),
395450 inputConfig : yamlConfig ,
396451 equivalentConfig : yamlConfigNodeNetworking ,
@@ -404,18 +459,25 @@ func TestCloudConfigTransformer(t *testing.T) {
404459 },
405460 {
406461 name : "yaml config should contain ipv4-primary dual-stack config and correct excluded subnets" ,
407- infraBuilder : newVsphereInfraBuilder ().withVSphereNodeNetworking ().withPrimaryIPv4VIP (),
462+ infraBuilder : newVsphereInfraBuilder ().withVSphereDefaultNodeNetworking ().withPrimaryIPv4VIP (),
408463 networkBuilder : withDualStackPrimaryIPv4NetworkConfig (),
409464 inputConfig : yamlConfig ,
410465 equivalentConfig : yamlConfigNodeNetworkingDualStackPrimaryIPv4 ,
411466 },
412467 {
413468 name : "yaml config should contain ipv6-primary dual-stack config and correct excluded subnets" ,
414- infraBuilder : newVsphereInfraBuilder ().withVSphereNodeNetworking ().withPrimaryIPv6VIP (),
469+ infraBuilder : newVsphereInfraBuilder ().withVSphereDefaultNodeNetworking ().withPrimaryIPv6VIP (),
415470 networkBuilder : withDualStackPrimaryIPv6NetworkConfig (),
416471 inputConfig : yamlConfig ,
417472 equivalentConfig : yamlConfigNodeNetworkingDualStackPrimaryIPv6 ,
418473 },
474+ {
475+ name : "yaml config should contain ipv6-only config and correct excluded subnets" ,
476+ infraBuilder : newVsphereInfraBuilder ().withVSphereIPv6onlyNodeNetworking ().withIPv6onlyVIP (),
477+ networkBuilder : withIPv6onlyNetworkConfig (),
478+ inputConfig : yamlConfig ,
479+ equivalentConfig : yamlConfigNodeNetworkingIPv6only ,
480+ },
419481 {
420482 name : "empty input" ,
421483 infraBuilder : newVsphereInfraBuilder (),
0 commit comments