From 91bded5881d2ff2d52261035d045f9038206af26 Mon Sep 17 00:00:00 2001 From: vimystic <122659254+vimystic@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:47:25 -0700 Subject: [PATCH] Remove redundant parameters --- controllers/cosmosfullnode_controller.go | 2 +- internal/fullnode/pod_control.go | 1 - internal/fullnode/pod_control_test.go | 24 ++++++++++++------------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/controllers/cosmosfullnode_controller.go b/controllers/cosmosfullnode_controller.go index e5a9929d..005a955f 100644 --- a/controllers/cosmosfullnode_controller.go +++ b/controllers/cosmosfullnode_controller.go @@ -174,7 +174,7 @@ func (r *CosmosFullNodeReconciler) Reconcile(ctx context.Context, req ctrl.Reque } // Reconcile pods. - podRequeue, err := r.podControl.Reconcile(ctx, reporter, crd, configCksums, syncInfo, crd.Spec.Ordinal.Start) + podRequeue, err := r.podControl.Reconcile(ctx, reporter, crd, configCksums, syncInfo) if err != nil { errs.Append(err) } diff --git a/internal/fullnode/pod_control.go b/internal/fullnode/pod_control.go index 9fab0795..8fc8a0d0 100644 --- a/internal/fullnode/pod_control.go +++ b/internal/fullnode/pod_control.go @@ -51,7 +51,6 @@ func (pc PodControl) Reconcile( crd *cosmosv1.CosmosFullNode, cksums ConfigChecksums, syncInfo map[string]*cosmosv1.SyncInfoPodStatus, - startingOrdinal int32, ) (bool, kube.ReconcileError) { var pods corev1.PodList if err := pc.client.List(ctx, &pods, diff --git a/internal/fullnode/pod_control_test.go b/internal/fullnode/pod_control_test.go index f8c40f0a..efb55df7 100644 --- a/internal/fullnode/pod_control_test.go +++ b/internal/fullnode/pod_control_test.go @@ -82,7 +82,7 @@ func TestPodControl_Reconcile(t *testing.T) { } control := NewPodControl(mClient, nil) - requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) require.False(t, requeue) @@ -108,7 +108,7 @@ func TestPodControl_Reconcile(t *testing.T) { }) control := NewPodControl(mClient, nil) - requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, nil, 0) + requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, nil) require.NoError(t, err) require.True(t, requeue) @@ -153,7 +153,7 @@ func TestPodControl_Reconcile(t *testing.T) { // Trigger updates crd.Spec.PodTemplate.Image = "new-image" - requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) require.True(t, requeue) @@ -167,7 +167,7 @@ func TestPodControl_Reconcile(t *testing.T) { return kube.ComputeRollout(maxUnavail, desired, ready) } - requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) require.True(t, requeue) @@ -191,7 +191,7 @@ func TestPodControl_Reconcile(t *testing.T) { return kube.ComputeRollout(maxUnavail, desired, ready) } - requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) require.True(t, requeue) @@ -267,7 +267,7 @@ func TestPodControl_Reconcile(t *testing.T) { // Reconcile 1, should update 0 and 1 - requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) // only handled 2 updates, so should requeue. @@ -284,7 +284,7 @@ func TestPodControl_Reconcile(t *testing.T) { return kube.ComputeRollout(maxUnavail, desired, ready) } - requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) require.True(t, requeue) @@ -310,7 +310,7 @@ func TestPodControl_Reconcile(t *testing.T) { return kube.ComputeRollout(maxUnavail, desired, ready) } - requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) // no further updates yet, should requeue. @@ -334,7 +334,7 @@ func TestPodControl_Reconcile(t *testing.T) { return kube.ComputeRollout(maxUnavail, desired, ready) } - requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) // only handled 1 updates, so should requeue. @@ -353,7 +353,7 @@ func TestPodControl_Reconcile(t *testing.T) { return kube.ComputeRollout(maxUnavail, desired, ready) } - requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) require.True(t, requeue) @@ -381,7 +381,7 @@ func TestPodControl_Reconcile(t *testing.T) { return kube.ComputeRollout(maxUnavail, desired, ready) } - requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err = control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) // all updates are now handled, no longer need requeue. @@ -458,7 +458,7 @@ func TestPodControl_Reconcile(t *testing.T) { crd.Status.Height[pod.Name] = 100 } - requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo, 0) + requeue, err := control.Reconcile(ctx, nopReporter, &crd, nil, syncInfo) require.NoError(t, err) // all updates are handled, so should not requeue