Skip to content

Commit d17620f

Browse files
Set default to always associate gatway to vpc (#159)
* Set default to always associate gatway to vpc * Add missed file
1 parent 3df22c3 commit d17620f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pkg/gateway/model_build_service_network_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gateway
22

33
import (
44
"context"
5+
"fmt"
56
"testing"
67

78
"github.com/stretchr/testify/assert"
@@ -30,7 +31,7 @@ func Test_MeshModelBuild(t *testing.T) {
3031
wantErr: nil,
3132
wantName: "mesh1",
3233
wantIsDeleted: false,
33-
associateToVPC: false,
34+
associateToVPC: true,
3435
},
3536
{
3637
name: "Adding Mesh, and need VPC association",
@@ -67,13 +68,15 @@ func Test_MeshModelBuild(t *testing.T) {
6768
DeletionTimestamp: &now,
6869
},
6970
},
70-
wantErr: nil,
71-
wantName: "mesh1",
72-
wantIsDeleted: true,
71+
wantErr: nil,
72+
wantName: "mesh1",
73+
wantIsDeleted: true,
74+
associateToVPC: true,
7375
},
7476
}
7577

7678
for _, tt := range tests {
79+
fmt.Printf("Testing >>> %v\n", tt.name)
7780
t.Run(tt.name, func(t *testing.T) {
7881
builder := NewServiceNetworkModelBuilder()
7982

pkg/gateway/model_build_servicenetwork.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ func (t *serviceNetworkModelBuildTask) buildServiceNetwork(ctx context.Context)
6767
AssociateToVPC: false,
6868
}
6969

70+
// by default it is true
71+
spec.AssociateToVPC = true
7072
if len(t.gateway.ObjectMeta.Annotations) > 0 {
7173
if value, exist := t.gateway.Annotations[LatticeVPCAssociationAnnotation]; exist {
7274
if value == "true" {
7375
spec.AssociateToVPC = true
76+
} else {
77+
spec.AssociateToVPC = false
7478
}
7579

7680
}

0 commit comments

Comments
 (0)