From 3cff30b081100f5dec55765514f79d77f73168da Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Mon, 11 Sep 2023 19:17:12 +0530 Subject: [PATCH] Fix nodepool reconciliation issue (#327) * Fix reconciliation comparisons when there are no NSGs --- cloud/scope/util.go | 3 +++ exp/controllers/ocimanaged_machinepool_controller.go | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cloud/scope/util.go b/cloud/scope/util.go index 01310e74..9ffbe788 100644 --- a/cloud/scope/util.go +++ b/cloud/scope/util.go @@ -26,6 +26,9 @@ const ( // GetNsgNamesFromId returns the names of the NSGs with the provided IDs func GetNsgNamesFromId(ids []string, nsgs []*infrastructurev1beta2.NSG) []string { + if len(ids) == 0 { + return nil + } names := make([]string, 0) for _, id := range ids { for _, nsg := range nsgs { diff --git a/exp/controllers/ocimanaged_machinepool_controller.go b/exp/controllers/ocimanaged_machinepool_controller.go index 09fbcfb1..bf37a947 100644 --- a/exp/controllers/ocimanaged_machinepool_controller.go +++ b/exp/controllers/ocimanaged_machinepool_controller.go @@ -357,7 +357,6 @@ func (r *OCIManagedMachinePoolReconciler) reconcileManagedMachines(ctx context.C specInfraMachines := make([]infrav2exp.OCIMachinePoolMachine, 0) for _, node := range nodePool.Nodes { // deleted/failing nodes should not be added to spec - machinePoolScope.Info(string(node.LifecycleState)) if node.LifecycleState == oke.NodeLifecycleStateDeleted || node.LifecycleState == oke.NodeLifecycleStateFailing { continue }