Skip to content

Commit

Permalink
Write manual given nat ip into infra status
Browse files Browse the repository at this point in the history
  • Loading branch information
hebelsan committed May 3, 2024
1 parent 09a5dc7 commit 717c266
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/infrastructure/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func patchProviderStatusAndState(
infra.Status.State = state
}

for _, natIP := range status.Networks.NatIPs {
infra.Status.EgressCIDRs = append(infra.Status.EgressCIDRs, fmt.Sprintf("%s/32", natIP.IP))
}

if data, err := patch.Data(infra); err != nil {
return fmt.Errorf("failed getting patch data for infra %s: %w", infra.Name, err)
} else if string(data) == `{}` {
Expand Down
8 changes: 8 additions & 0 deletions pkg/controller/infrastructure/infraflow/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ func (fctx *FlowContext) getStatus() *v1alpha1.InfrastructureStatus {
}
}

if ipAddresses := fctx.whiteboard.GetObject(ObjectKeyIPAddress); ipAddresses != nil {
for _, ip := range ipAddresses.([]string) {
status.Networks.NatIPs = append(status.Networks.NatIPs, v1alpha1.NatIP{
IP: ip,
})
}
}

status.ServiceAccountEmail = ptr.Deref(fctx.whiteboard.GetChild(ChildKeyIDs).Get(KeyServiceAccountEmail), "")
return status
}
Expand Down

0 comments on commit 717c266

Please sign in to comment.