Skip to content

Commit e89ec1f

Browse files
authored
fix: check if IPv4 config in network is nil (#23)
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
1 parent 37222fb commit e89ec1f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/controller/infrastructure/stackit/infraflow/reconcile.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,15 @@ func (fctx *FlowContext) ensureEgressIP(ctx context.Context) error {
400400
if err != nil {
401401
return err
402402
}
403+
_, ok := network.GetIpv4Ok()
404+
if !ok {
405+
return fmt.Errorf("could not find IPv4 config in network: %s", network.GetId())
406+
}
403407
routerIP, ok := network.Ipv4.GetPublicIpOk()
404408
if ok {
405409
result = append(result, routerIP)
406410
fctx.state.SetObject(IdentifierEgressCIDRs, result)
407411
return nil
408412
}
409-
return fmt.Errorf("egress IP not found for network %s", network.GetId())
413+
return fmt.Errorf("egress IP not found for network: %s", network.GetId())
410414
}

0 commit comments

Comments
 (0)