disruption: remove unused pdb parameter from getExpectedScale method

Signed-off-by: xigang <wangxigang2014@gmail.com>
This commit is contained in:
xigang
2025-09-28 17:41:36 +08:00
parent ed49decb4a
commit 574ac5b497
2 changed files with 4 additions and 4 deletions

View File

@@ -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)

View File

@@ -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))
}