Skip to content

Commit d21b970

Browse files
authored
Merge pull request #941 from Colvin-Y/fix/porgroup-controller
fix: pogGroupController panic when no selected pod
2 parents 31b11f1 + 9507dbf commit d21b970

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/controllers/podgroup_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ func (r *PodGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
107107
case schedv1alpha1.PodGroupPending:
108108
if len(pods) >= int(pg.Spec.MinMember) {
109109
pgCopy.Status.Phase = schedv1alpha1.PodGroupScheduling
110-
fillOccupiedObj(pgCopy, &pods[0])
110+
if len(pods) > 0 {
111+
fillOccupiedObj(pgCopy, &pods[0])
112+
}
111113
}
112114
default:
113115
pgCopy.Status.Running, pgCopy.Status.Succeeded, pgCopy.Status.Failed = getCurrentPodStats(pods)

0 commit comments

Comments
 (0)