Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pkg/gateway/model_build_service_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gateway

import (
"context"
"fmt"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions pkg/gateway/model_build_servicenetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

}
Expand Down