vmware / cloud-provider-for-cloud-director

Kubernetes External Cloud Provider for VMware Cloud Director
Other
20 stars 30 forks source link

Modify IP space support check on edge gateway #375

Closed rocknes closed 4 months ago

rocknes commented 4 months ago

Previously, we assumed that each org vdc edge gateway can be connected to one provider gateway and hence have only 1 uplink. Recently, a customer issue has uncovered that it is indeed possible for an edge gateway to have multiple uplinks. One of the uplink will be the uplink to Provider Gateway, while rest would be uplink to NSX-T imported external networks.

in this PR, we are modifying the check to test IP space support on an edge gateway to ignore all NSX-T import network uplinks and only use the Provider gateway uplink for determination of IP space support.

Testing done: On a fresh VCD 10.5 testbed,

/usr/local/go/bin/go tool test2json -t /Users/sena/Library/Caches/JetBrains/GoLand2023.3/tmp/GoLand/___10TestGatewayUsingIpSpaces_in_github_com_vmware_cloud_provider_for_cloud_director_pkg_vcdsdk.test -test.v -test.paniconexit0 -test.run ^\QTestGatewayUsingIpSpaces\E$
=== RUN   TestGatewayUsingIpSpaces
I0723 15:05:03.953622    6042 auth.go:50] Using VCD OpenAPI version [37.2]
I0723 15:05:05.092706    6042 auth.go:74] Running module as sysadmin [false]
I0723 15:05:05.512544    6042 client.go:201] Client is sysadmin: [false]
I0723 15:05:06.506108    6042 gateway.go:70] Obtained Gateway [provider_vdc_edge] for Network Name [provider_orgvdc_net] of type [NSXT_FLEXIBLE_SEGMENT]
I0723 15:05:07.639639    6042 gateway.go:70] Obtained Gateway [provider_org_edge_no_ipspace] for Network Name [provider_orgvdc_net_no_ipspace] of type [NSXT_FLEXIBLE_SEGMENT]
--- PASS: TestGatewayUsingIpSpaces (3.78s)
PASS