diff --git a/pkg/gateway/model_build_service_network_test.go b/pkg/gateway/model_build_service_network_test.go index 0bb55a8c..2ecf7624 100644 --- a/pkg/gateway/model_build_service_network_test.go +++ b/pkg/gateway/model_build_service_network_test.go @@ -2,6 +2,7 @@ package gateway import ( "context" + "fmt" "testing" "github.com/stretchr/testify/assert" @@ -30,7 +31,7 @@ func Test_MeshModelBuild(t *testing.T) { wantErr: nil, wantName: "mesh1", wantIsDeleted: false, - associateToVPC: false, + associateToVPC: true, }, { name: "Adding Mesh, and need VPC association", @@ -67,13 +68,15 @@ func Test_MeshModelBuild(t *testing.T) { DeletionTimestamp: &now, }, }, - wantErr: nil, - wantName: "mesh1", - wantIsDeleted: true, + wantErr: nil, + wantName: "mesh1", + wantIsDeleted: true, + associateToVPC: true, }, } for _, tt := range tests { + fmt.Printf("Testing >>> %v\n", tt.name) t.Run(tt.name, func(t *testing.T) { builder := NewServiceNetworkModelBuilder() diff --git a/pkg/gateway/model_build_servicenetwork.go b/pkg/gateway/model_build_servicenetwork.go index d65556df..0e72af13 100644 --- a/pkg/gateway/model_build_servicenetwork.go +++ b/pkg/gateway/model_build_servicenetwork.go @@ -67,10 +67,14 @@ func (t *serviceNetworkModelBuildTask) buildServiceNetwork(ctx context.Context) AssociateToVPC: false, } + // by default it is true + spec.AssociateToVPC = true if len(t.gateway.ObjectMeta.Annotations) > 0 { if value, exist := t.gateway.Annotations[LatticeVPCAssociationAnnotation]; exist { if value == "true" { spec.AssociateToVPC = true + } else { + spec.AssociateToVPC = false } }