From 574ac5b497833eec6663950b71346237b6b3cf15 Mon Sep 17 00:00:00 2001 From: xigang Date: Sun, 28 Sep 2025 17:41:36 +0800 Subject: [PATCH] disruption: remove unused pdb parameter from getExpectedScale method Signed-off-by: xigang --- pkg/controller/disruption/disruption.go | 6 +++--- pkg/controller/disruption/disruption_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/controller/disruption/disruption.go b/pkg/controller/disruption/disruption.go index e1f778b65a8..e58c4adfe2c 100644 --- a/pkg/controller/disruption/disruption.go +++ b/pkg/controller/disruption/disruption.go @@ -813,7 +813,7 @@ func (dc *DisruptionController) getExpectedPodCount(ctx context.Context, pdb *po // handled the same way for integer and percentage minAvailable if pdb.Spec.MaxUnavailable != nil { - expectedCount, unmanagedPods, err = dc.getExpectedScale(ctx, pdb, pods) + expectedCount, unmanagedPods, err = dc.getExpectedScale(ctx, pods) if err != nil { return } @@ -831,7 +831,7 @@ func (dc *DisruptionController) getExpectedPodCount(ctx context.Context, pdb *po desiredHealthy = pdb.Spec.MinAvailable.IntVal expectedCount = int32(len(pods)) } else if pdb.Spec.MinAvailable.Type == intstr.String { - expectedCount, unmanagedPods, err = dc.getExpectedScale(ctx, pdb, pods) + expectedCount, unmanagedPods, err = dc.getExpectedScale(ctx, pods) if err != nil { return } @@ -847,7 +847,7 @@ func (dc *DisruptionController) getExpectedPodCount(ctx context.Context, pdb *po return } -func (dc *DisruptionController) getExpectedScale(ctx context.Context, pdb *policy.PodDisruptionBudget, pods []*v1.Pod) (expectedCount int32, unmanagedPods []string, err error) { +func (dc *DisruptionController) getExpectedScale(ctx context.Context, pods []*v1.Pod) (expectedCount int32, unmanagedPods []string, err error) { // When the user specifies a fraction of pods that must be available, we // use as the fraction's denominator // SUM_{all c in C} scale(c) diff --git a/pkg/controller/disruption/disruption_test.go b/pkg/controller/disruption/disruption_test.go index 01c77371bdf..4f9fa4b8996 100644 --- a/pkg/controller/disruption/disruption_test.go +++ b/pkg/controller/disruption/disruption_test.go @@ -625,7 +625,7 @@ func TestTotalUnmanagedPods(t *testing.T) { dc.sync(ctx, pdbName) var pods []*v1.Pod pods = append(pods, pod) - _, unmanagedPods, _ := dc.getExpectedScale(ctx, pdb, pods) + _, unmanagedPods, _ := dc.getExpectedScale(ctx, pods) if len(unmanagedPods) != 1 { t.Fatalf("expected one pod to be unmanaged pod but found %d", len(unmanagedPods)) }