From 2a9feaf5910b48548dbc2b171554f103caeedb80 Mon Sep 17 00:00:00 2001 From: abhinavnagaraj Date: Tue, 7 Jul 2020 13:54:57 -0700 Subject: [PATCH] wait only if static ip is not available --- controllers/vspherevm_controller.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/controllers/vspherevm_controller.go b/controllers/vspherevm_controller.go index e07826ed14..0b3a3ec56a 100644 --- a/controllers/vspherevm_controller.go +++ b/controllers/vspherevm_controller.go @@ -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 } }