operating icon indicating copy to clipboard operation
operating copied to clipboard

Bug: When using PodToDelete along with decreasing replicas, the priority should consider PodToDelete list

Open wu8685 opened this issue 1 year ago • 1 comments

Minimal reproduce step

Scale in 2 pods, along with more than 2, let's say 3 podToDelete.

What did you expect to see?

2 Pods from podToDelete list should be delete with scale-in label, and 1 Pod should be recreated.

What did you see instead

The deletion priority may not consider PodToDelete list. https://github.com/KusionStack/kuperator/blob/v0.5.3/pkg/controllers/collaset/synccontrol/sync_control.go#L403

What is your KusionStack components and its version?

0.5.0

wu8685 avatar Sep 06 '24 15:09 wu8685

In fact, it works as expected now, as following: (1) for pods in podToDelete list, we mark the podWrapper.toDelete=true, otherwise false: https://github.com/KusionStack/kuperator/blob/c224fb208e1cf8e065d6c4131a81675f5eb593fe/pkg/controllers/collaset/synccontrol/sync_control.go#L173

(2) then we sort and assign toDelete=true pods with highest priority in getPodsToDelete(),: https://github.com/KusionStack/kuperator/blob/c224fb208e1cf8e065d6c4131a81675f5eb593fe/pkg/controllers/collaset/synccontrol/scale.go#L66

As a result:

  • for pods in podToDelete list but out of replicas, they will be scaled in
  • for pod in podToDelete list, and in range of replicas, they will be recreate d

ColdsteelRail avatar Sep 07 '24 09:09 ColdsteelRail