Skip to content

Commit

Permalink
Add VPCConnectivityProfile
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Qiu <wenqiq@vmware.com>
  • Loading branch information
wenqiq committed Jun 21, 2024
1 parent e785932 commit 247ef00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/nsx/services/vpc/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func buildNSXVPC(obj *v1alpha1.NetworkInfo, nsObj *v1.Namespace, nc common.VPCNe
// update private/public blocks
vpc.ExternalIpv4Blocks = nc.ExternalIPv4Blocks
vpc.PrivateIpv4Blocks = util.GetMapValues(pathMap)
vpc.VpcConnectivityProfile = &nc.VPCConnectivityProfile
if nc.ShortID != "" {
vpc.ShortId = &nc.ShortID
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/nsx/services/vpc/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,15 @@ func (s *VPCService) CreateOrUpdateVPC(obj *v1alpha1.NetworkInfo) (*model.Vpc, *
return existingVPC[0], &nc, nil
}

if nc.VPCConnectivityProfile != "" {
vpcConnectivityProfile, err := s.NSXClient.VpcConnectivityProfilesClient.Get(nc.Org, nc.NsxtProject, nc.VPCConnectivityProfile)
if err != nil {
log.Error(err, "vpcConnectivityProfile does not exists", "Project", nc.NsxtProject, "VPCConnectivityProfile", nc.VPCConnectivityProfile)
return nil, nil, err
}
createdVpc.ExternalIpv4Blocks = vpcConnectivityProfile.ExternalIpBlocks
}

log.Info("creating NSX VPC", "VPC", *createdVpc.Id)
err = s.NSXClient.VPCClient.Patch(nc.Org, nc.NsxtProject, *createdVpc.Id, *createdVpc)
if err != nil {
Expand Down

0 comments on commit 247ef00

Please sign in to comment.