Skip to content

Commit

Permalink
ignore fip without target, instead of returning an error (#224)
Browse files Browse the repository at this point in the history
* ignore fip without target, instead of returning an error

Signed-off-by: adisos <[email protected]>

* update fip warning msg

Signed-off-by: adisos <[email protected]>

---------

Signed-off-by: adisos <[email protected]>
  • Loading branch information
adisos authored Nov 9, 2023
1 parent a00b615 commit c45d49a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/ibmvpc/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ func getPgwConfig(
return nil
}

func ignoreFIPWarning(fipName, details string) string {
return fmt.Sprintf("warning: ignoring floatingIP %s: %s", fipName, details)
}

func getFipConfig(
rc *ResourcesContainer,
res map[string]*vpcmodel.VPCConfig,
Expand All @@ -529,11 +533,15 @@ func getFipConfig(
targetUID = *target.PrimaryIP.ID
case *vpc1.FloatingIPTarget:
if *target.ResourceType != networkInterfaceResourceType {
fmt.Println(ignoreFIPWarning(*fip.Name,
fmt.Sprintf("target.ResourceType %s is not supported (only networkInterfaceResourceType supported)",
*target.ResourceType)))
continue
}
targetUID = *target.PrimaryIP.ID
default:
return fmt.Errorf("unsupported fip target : %s", target)
fmt.Println(ignoreFIPWarning(*fip.Name, "target (FloatingIPTargetIntf) is not of the expected type"))
continue
}

if targetUID == "" {
Expand Down Expand Up @@ -920,7 +928,7 @@ func VPCConfigsFromResources(rc *ResourcesContainer, vpcID string, debug bool) (
func filterVPCSAndAddExternalNodes(vpcInternalAddressRange map[string]*common.IPBlock, res map[string]*vpcmodel.VPCConfig) error {
for vpcUID, vpcConfig := range res {
if vpcInternalAddressRange[vpcUID] == nil {
fmt.Printf("Ignoring VPC %s, no subnets found fot this VPC\n", vpcUID)
fmt.Printf("Ignoring VPC %s, no subnets found for this VPC\n", vpcUID)
delete(res, vpcUID)
continue
}
Expand Down

0 comments on commit c45d49a

Please sign in to comment.