diff --git a/controllers/pod.go b/controllers/pod.go index 04708fc1..05451e98 100644 --- a/controllers/pod.go +++ b/controllers/pod.go @@ -1537,13 +1537,13 @@ func (r *SingleClusterReconciler) updateOperationStatus(restartedASDPodNames, re statusPods := sets.New(statusOp.PodList...) if statusOp.Kind == asdbv1.OperationWarmRestart { - if quickRestartsSet != nil { + if quickRestartsSet.Len() > 0 { statusOp.PodList = statusPods.Union(quickRestartsSet.Intersection(specPods)).UnsortedList() } // If the operation is a warm restart and the pod undergoes a cold restart for any reason, // we will still consider the warm restart operation as completed for that pod. - if podRestartsSet != nil { + if podRestartsSet.Len() > 0 { statusOp.PodList = statusPods.Union(podRestartsSet.Intersection(specPods)).UnsortedList() } } @@ -1561,13 +1561,13 @@ func (r *SingleClusterReconciler) updateOperationStatus(restartedASDPodNames, re var podList []string if specOp.Kind == asdbv1.OperationWarmRestart { - if quickRestartsSet != nil { + if quickRestartsSet.Len() > 0 { podList = quickRestartsSet.Intersection(specPods).UnsortedList() } // If the operation is a warm restart and the pod undergoes a cold restart for any reason, // we will still consider the warm restart operation as completed for that pod. - if podRestartsSet != nil { + if podRestartsSet.Len() > 0 { podList = append(podList, podRestartsSet.Intersection(specPods).UnsortedList()...) } } diff --git a/controllers/rack.go b/controllers/rack.go index c98ad201..061e25d5 100644 --- a/controllers/rack.go +++ b/controllers/rack.go @@ -86,7 +86,7 @@ func (r *SingleClusterReconciler) reconcileRacks() reconcileResult { // remove ignorable pods from failedPods failedPods = getNonIgnorablePods(failedPods, ignorablePodNames) if len(failedPods) != 0 { - r.Log.Info("Reconcile the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", failedPods) + r.Log.Info("Reconcile the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", getPodNames(failedPods)) if res = r.reconcileRack( found, state, ignorablePodNames, failedPods, @@ -94,7 +94,7 @@ func (r *SingleClusterReconciler) reconcileRacks() reconcileResult { return res } - r.Log.Info("Reconciled the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", failedPods) + r.Log.Info("Reconciled the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", getPodNames(failedPods)) } // 2. Again, fetch the pods for the rack and if there are failed pods then restart them. @@ -114,14 +114,14 @@ func (r *SingleClusterReconciler) reconcileRacks() reconcileResult { // remove ignorable pods from failedPods failedPods = getNonIgnorablePods(failedPods, ignorablePodNames) if len(failedPods) != 0 { - r.Log.Info("Restart the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", failedPods) + r.Log.Info("Restart the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", getPodNames(failedPods)) if _, res = r.rollingRestartRack(found, state, ignorablePodNames, nil, failedPods); !res.isSuccess { return res } - r.Log.Info("Restarted the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", failedPods) + r.Log.Info("Restarted the failed pods in the Rack", "rackID", state.Rack.ID, "failedPods", getPodNames(failedPods)) // Requeue after 1 second to fetch latest CR object with updated pod status return reconcileRequeueAfter(1) } diff --git a/test/cluster_test.go b/test/cluster_test.go index 1c19952c..df802367 100644 --- a/test/cluster_test.go +++ b/test/cluster_test.go @@ -350,6 +350,7 @@ func clusterWithMaxIgnorablePod(ctx goctx.Context) { err = k8sClient.Update(ctx, pod) Expect(err).ToNot(HaveOccurred()) + // Underlying kubernetes cluster should have atleast 6 nodes to run this test successfully. By("Delete rack with id 2") aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred())