From 8e0ab0b6fd00b19bbcc481362e807c6589895843 Mon Sep 17 00:00:00 2001 From: Wenqi Qiu Date: Tue, 4 Jun 2024 17:21:40 +0800 Subject: [PATCH] Update Signed-off-by: Wenqi Qiu --- .gitignore | 4 +++- go.mod | 4 +--- go.sum | 2 -- .../networkinfo/vpcnetworkconfig_handler.go | 22 +++++++++---------- pkg/nsx/services/common/types.go | 20 +++++++++-------- test/e2e/nsx_subnet_test.go | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 59402d8ae..da0a9271e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ bin/ .DS_Store go.work -go.work.sum \ No newline at end of file +go.work.sum +vendor/ +.golangci-bin/ \ No newline at end of file diff --git a/go.mod b/go.mod index d522fd7c8..e7cef4ed3 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,8 @@ module github.com/vmware-tanzu/nsx-operator go 1.21.9 replace ( - github.com/vmware-tanzu/nsx-operator/pkg/apis => ./pkg/apis github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha1 => ./pkg/apis/v1alpha1 github.com/vmware-tanzu/nsx-operator/pkg/apis/v1alpha2 => ./pkg/apis/v1alpha2 - github.com/vmware-tanzu/nsx-operator/pkg/client => ./pkg/client ) replace ( @@ -19,6 +17,7 @@ require ( github.com/apparentlymart/go-cidr v1.1.0 github.com/deckarep/golang-set v1.8.0 github.com/go-logr/logr v1.3.0 + github.com/go-logr/zapr v1.2.4 github.com/golang-jwt/jwt v3.2.2+incompatible github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 @@ -58,7 +57,6 @@ require ( github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gibson042/canonicaljson-go v1.0.3 // indirect - github.com/go-logr/zapr v1.2.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect diff --git a/go.sum b/go.sum index e9a5b9a89..21c141b9a 100644 --- a/go.sum +++ b/go.sum @@ -177,8 +177,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/vmware-tanzu/nsx-operator/pkg/client v0.0.0-20240102061654-537b080e159f h1:EV4eiUQr3QpUGfTtqdVph0+bmE+3cj0aNJpd9n2qTdo= -github.com/vmware-tanzu/nsx-operator/pkg/client v0.0.0-20240102061654-537b080e159f/go.mod h1:dzob8tUzpAREQPtbbjQs4b1UyQDR37B2TiIdg8WJSRM= github.com/vmware-tanzu/vm-operator/api v1.8.2 h1:7cZHVusqAmAMFWvsiU7X5xontxdjasknI/sVfe0p0Z4= github.com/vmware-tanzu/vm-operator/api v1.8.2/go.mod h1:vauVboD3sQxP+pb28TnI9wfrj+0nH2zSEc9Q7AzWJ54= github.com/vmware/govmomi v0.27.4 h1:5kY8TAkhB20lsjzrjE073eRb8+HixBI29PVMG5lxq6I= diff --git a/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go b/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go index e580dbf2a..20624d6a8 100644 --- a/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go +++ b/pkg/controllers/networkinfo/vpcnetworkconfig_handler.go @@ -121,17 +121,17 @@ func buildNetworkConfigInfo(vpcConfigCR v1alpha1.VPCNetworkConfiguration) (*comm } ninfo := &commontypes.VPCNetworkConfigInfo{ - IsDefault: isDefaultNetworkConfigCR(vpcConfigCR), - Org: org, - Name: vpcConfigCR.Name, - DefaultGatewayPath: vpcConfigCR.Spec.DefaultGatewayPath, - EdgeClusterPath: vpcConfigCR.Spec.EdgeClusterPath, - NsxtProject: project, - ExternalIPv4Blocks: vpcConfigCR.Spec.ExternalIPv4Blocks, - PrivateIPv4CIDRs: vpcConfigCR.Spec.PrivateIPv4CIDRs, - DefaultIPv4SubnetSize: vpcConfigCR.Spec.DefaultIPv4SubnetSize, - DefaultSubnetAccessMode: vpcConfigCR.Spec.DefaultSubnetAccessMode, - ShortID: vpcConfigCR.Spec.ShortID, + IsDefault: isDefaultNetworkConfigCR(vpcConfigCR), + Org: org, + Name: vpcConfigCR.Name, + DefaultGatewayPath: vpcConfigCR.Spec.DefaultGatewayPath, + EdgeClusterPath: vpcConfigCR.Spec.EdgeClusterPath, + NsxtProject: project, + ExternalIPv4Blocks: vpcConfigCR.Spec.ExternalIPv4Blocks, + PrivateIPv4CIDRs: vpcConfigCR.Spec.PrivateIPv4CIDRs, + DefaultIPv4SubnetSize: vpcConfigCR.Spec.DefaultIPv4SubnetSize, + DefaultPodSubnetAccessMode: vpcConfigCR.Spec.DefaultPodSubnetAccessMode, + ShortID: vpcConfigCR.Spec.ShortID, } return ninfo, nil } diff --git a/pkg/nsx/services/common/types.go b/pkg/nsx/services/common/types.go index b82aee8e3..fae9771bc 100644 --- a/pkg/nsx/services/common/types.go +++ b/pkg/nsx/services/common/types.go @@ -195,15 +195,17 @@ type VPCResourceInfo struct { } type VPCNetworkConfigInfo struct { - IsDefault bool - Org string - Name string - DefaultGatewayPath string - EdgeClusterPath string - NsxtProject string - ExternalIPv4Blocks []string - PrivateIPv4CIDRs []string - DefaultIPv4SubnetSize int + IsDefault bool + Org string + Name string + DefaultGatewayPath string + EdgeClusterPath string + NsxtProject string + ExternalIPv4Blocks []string + PrivateIPv4CIDRs []string + DefaultIPv4SubnetSize int + // DefaultSubnetAccessMode + // DefaultPodSubnetAccessMode DefaultPodSubnetAccessMode string ShortID string } diff --git a/test/e2e/nsx_subnet_test.go b/test/e2e/nsx_subnet_test.go index 4ac980ff3..35aa3ba96 100644 --- a/test/e2e/nsx_subnet_test.go +++ b/test/e2e/nsx_subnet_test.go @@ -187,7 +187,7 @@ func UserSubnetSet(t *testing.T) { assertNil(t, err) // 2. Check `Ipv4SubnetSize` and `AccessMode` should be same with related fields in VPCNetworkConfig. - assertTrue(t, verifySubnetSetCR(UserSubnetSet, "Private")) + assertTrue(t, verifySubnetSetCR(subnetSetName, "Private")) portPath, _ := filepath.Abs(portYAML) err = applyYAML(portPath, E2ENamespace)