diff --git a/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml b/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml index e7fc53f7f..5430f4ff6 100644 --- a/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml +++ b/build/yaml/crd/vpc/crd.nsx.vmware.com_networkinfos.yaml @@ -55,9 +55,6 @@ spec: items: type: string type: array - vpcPath: - description: NSX Policy path for VPC. - type: string required: - defaultSNATIP - name diff --git a/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml b/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml index 06752bcc6..eccdeb8c6 100644 --- a/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml +++ b/build/yaml/samples/nsx_v1alpha1_networkinfo.yaml @@ -13,4 +13,3 @@ vpcs: name: vpc-d110d5aa-006d-4b59-9caf-424a4fba932c--kube-system privateIPs: - 172.26.0.0/16 - vpcPath: /orgs/default/projects/project-quality/vpcs/19a8a52e-beb0-4396-91ce-5821a15a43db \ No newline at end of file diff --git a/pkg/apis/vpc/v1alpha1/networkinfo_types.go b/pkg/apis/vpc/v1alpha1/networkinfo_types.go index 0114b87e4..a6aaf3b28 100644 --- a/pkg/apis/vpc/v1alpha1/networkinfo_types.go +++ b/pkg/apis/vpc/v1alpha1/networkinfo_types.go @@ -39,8 +39,6 @@ type VPCState struct { LoadBalancerIPAddresses string `json:"loadBalancerIPAddresses,omitempty"` // Private CIDRs used for the VPC. PrivateIPs []string `json:"privateIPs,omitempty"` - // NSX Policy path for VPC. - VPCPath string `json:"vpcPath,omitempty"` } func init() { diff --git a/pkg/controllers/networkinfo/networkinfo_controller.go b/pkg/controllers/networkinfo/networkinfo_controller.go index 3dbd6533f..19b69db9a 100644 --- a/pkg/controllers/networkinfo/networkinfo_controller.go +++ b/pkg/controllers/networkinfo/networkinfo_controller.go @@ -322,7 +322,6 @@ func (r *NetworkInfoReconciler) Reconcile(ctx context.Context, req ctrl.Request) DefaultSNATIP: snatIP, LoadBalancerIPAddresses: cidr, PrivateIPs: privateIPs, - VPCPath: *createdVpc.Path, } // AKO needs to know the AVI subnet path created by NSX diff --git a/test/e2e/nsx_networkinfo_test.go b/test/e2e/nsx_networkinfo_test.go index b4d0ab00f..1304352b8 100644 --- a/test/e2e/nsx_networkinfo_test.go +++ b/test/e2e/nsx_networkinfo_test.go @@ -165,7 +165,7 @@ func testUpdateVPCNetworkconfigNetworkInfo(t *testing.T) { networkInfo := assureNetworkInfo(t, ns, ns) require.NotNil(t, networkInfo) - networkInfoNew := getVPCPathFromNetworkInfo(t, ns, networkInfo.Name) + networkInfoNew := getNetworkInfoWithPrivateIPs(t, ns, networkInfo.Name) privateIPs := networkInfoNew.VPCs[0].PrivateIPs assert.Contains(t, privateIPs, customizedPrivateCIDR1, "privateIPs %s should contain %s", privateIPs, customizedPrivateCIDR1) assert.Contains(t, privateIPs, customizedPrivateCIDR2, "privateIPs %s should contain %s", privateIPs, customizedPrivateCIDR1) @@ -173,7 +173,7 @@ func testUpdateVPCNetworkconfigNetworkInfo(t *testing.T) { vncPath, _ := filepath.Abs("./manifest/testVPC/customize_networkconfig_updated.yaml") require.NoError(t, applyYAML(vncPath, "")) - networkInfoNew = getVPCPathFromNetworkInfo(t, ns, networkInfo.Name) + networkInfoNew = getNetworkInfoWithPrivateIPs(t, ns, networkInfo.Name) privateIPs = networkInfoNew.VPCs[0].PrivateIPs assert.Contains(t, privateIPs, customizedPrivateCIDR3, "privateIPs %s should contain %s", privateIPs, customizedPrivateCIDR3) } @@ -264,16 +264,16 @@ func assureNamespaceDeleted(t *testing.T, ns string) { return } -func getVPCPathFromNetworkInfo(t *testing.T, ns, networkInfoName string) (networkInfo *v1alpha1.NetworkInfo) { +func getNetworkInfoWithPrivateIPs(t *testing.T, ns, networkInfoName string) (networkInfo *v1alpha1.NetworkInfo) { deadlineCtx, deadlineCancel := context.WithTimeout(context.Background(), defaultTimeout) defer deadlineCancel() err := wait.PollUntilContextTimeout(deadlineCtx, 1*time.Second, defaultTimeout, false, func(ctx context.Context) (done bool, err error) { networkInfo, err = testData.crdClientset.CrdV1alpha1().NetworkInfos(ns).Get(ctx, networkInfoName, v1.GetOptions{}) if err != nil { - log.Error(err, "Check VPC path of vpcnetworkconfigurations networkInfo", networkInfo) - return false, fmt.Errorf("error when waiting for vpcnetworkconfigurations VPC path: %s", networkInfoName) + t.Logf("Check private ips of networkinfo: %v, error: %+v", networkInfo, err) + return false, fmt.Errorf("error when waiting for vpcnetworkinfo private ips: %s", networkInfoName) } - if len(networkInfo.VPCs) > 0 && networkInfo.VPCs[0].VPCPath != "" { + if len(networkInfo.VPCs) > 0 && len(networkInfo.VPCs[0].PrivateIPs) > 0 { return true, nil } return false, nil