Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Qiu <[email protected]>
  • Loading branch information
wenqiq committed Jul 30, 2024
1 parent 111ba73 commit 297c3e8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
5 changes: 1 addition & 4 deletions pkg/controllers/networkinfo/networkinfo_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,10 @@ func (r *NetworkInfoReconciler) Reconcile(ctx context.Context, req ctrl.Request)
vpcConnectivityProfileName := parts[len(parts)-1]
vpcConnectivityProfile, err := r.Service.NSXClient.VPCConnectivityProfilesClient.Get(nc.Org, nc.NSXProject, vpcConnectivityProfileName)
if err != nil {
log.Error(err, "failed to get NSX VPC ConnectivityProfile object")
log.Error(err, "failed to get NSX VPC ConnectivityProfile object", "vpcConnectivityProfileName", vpcConnectivityProfileName)
return common.ResultRequeue, err
}
isEnableAutoSNAT := func() bool {
if createdVpc.ServiceGateway != nil && createdVpc.ServiceGateway.AutoSnat != nil {
return *createdVpc.ServiceGateway.AutoSnat
}
if vpcConnectivityProfile.ServiceGateway == nil || vpcConnectivityProfile.ServiceGateway.Enable == nil {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/nsx/services/subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (service *SubnetService) GetSubnetStatus(subnet *model.VpcSubnet) ([]model.
}
if statusList.Results[0].NetworkAddress == nil || statusList.Results[0].GatewayAddress == nil {
err := fmt.Errorf("invalid status result: %+v", statusList.Results[0])
log.Error(err, "invalid subnet status")
log.Error(err, "subnet status does not have network address or network address", "subnet.Id", subnet.Id)
return nil, err
}
return statusList.Results, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/nsx/services/subnetport/subnetport.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ func (service *SubnetPortService) GetGatewayPrefixForSubnetPort(obj *v1alpha1.Su
return "", -1, err
}
status := statusList.Results[0]
if *status.Status != model.VpcSubnetStatus_STATUS_SUCCESS || status.GatewayAddress == nil {
if status.GatewayAddress == nil {
err := fmt.Errorf("invalid status result: %+v", status)
log.Error(err, "invalid subnet status")
log.Error(err, "subnet status does not have gateway address", "nsxSubnetPath", nsxSubnetPath)
return "", -1, err
}
gateway, err := util.RemoveIPPrefix(*status.GatewayAddress)
Expand Down
1 change: 1 addition & 0 deletions pkg/nsx/services/vpc/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func buildNSXVPC(obj *v1alpha1.NetworkInfo, nsObj *v1.Namespace, nc common.VPCNe

vpc.VpcConnectivityProfile = &nc.VPCConnectivityProfile

// TODO: add PrivateIps and remove PrivateIpv4Blocks once the NSX VPC API support private_ips field.
// vpc.PrivateIps = nc.PrivateIPs
vpc.PrivateIpv4Blocks = util.GetMapValues(pathMap)
if nc.ShortID != "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/nsx/services/vpc/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ func (s *VPCService) GetAVISubnetInfo(vpc model.Vpc) (string, string, error) {

if statusList.Results[0].NetworkAddress == nil {
err := fmt.Errorf("invalid status result: %+v", statusList.Results[0])
log.Error(err, "invalid subnet status")
log.Error(err, "subnet status does not have network address", "Subnet", common.AVISubnetLBID)
return "", "", err
}

Expand Down

0 comments on commit 297c3e8

Please sign in to comment.