Skip to content

Commit

Permalink
wait only if static ip is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavnagaraj committed Jul 7, 2020
1 parent 6dcc4f5 commit 2a9feaf
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions controllers/vspherevm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,21 +362,13 @@ func (r vmReconciler) reconcileNormal(ctx *context.VMContext) (reconcile.Result,
}

func (r vmReconciler) isWaitingForStaticIPAllocation(ctx *context.VMContext) bool {
// Requeue if the two DHCP flags are set to false
// and no static IP is set in the IPAddrs.
waitForIP := false
devices := ctx.VSphereVM.Spec.Network.Devices

for _, dev := range devices {
// If DHCP is set for any of the devices,
// assume DHCP as the default allocation type.
if dev.DHCP4 || dev.DHCP6 {
return false
} else {
if len(dev.IPAddrs) == 0 {
// Static IP is not available yet
waitForIP = true
}
if !dev.DHCP4 && !dev.DHCP6 && len(dev.IPAddrs) == 0 {
// Static IP is not available yet
waitForIP = true
}
}

Expand Down

0 comments on commit 2a9feaf

Please sign in to comment.