mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-08-08 23:37:11 +00:00
disruption: remove unused pdb parameter from getExpectedScale method
Signed-off-by: xigang <wangxigang2014@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user