Skip to content

Commit

Permalink
Fix the issue of missing Pods in pub list function (#1274)
Browse files Browse the repository at this point in the history
Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
  • Loading branch information
zmberg committed May 8, 2023
1 parent 7f5046d commit 437ba70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/util/controllerfinder/pods_finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ func (r *ControllerFinder) getReplicaSetsForObject(scale *ScaleAndSelector) ([]a
rss := make([]appsv1.ReplicaSet, 0)
for i := range rsList.Items {
rs := rsList.Items[i]
if *rs.Spec.Replicas == 0 || !rs.DeletionTimestamp.IsZero() {
// This method is used to list the pods of the deployment, so the rs of spec.replicas == 0 cannot be ignored,
// because even if rs.spec.replicas == 0, rs may still contain pods.
if !rs.DeletionTimestamp.IsZero() {
continue
}
if ref := metav1.GetControllerOf(&rs); ref != nil && ref.UID == scale.UID {
Expand Down

0 comments on commit 437ba70

Please sign in to comment.