Skip to content

Commit 9507dbf

Browse files
committed
fix: pogGroupController panic when no selected pod
Signed-off-by: Colvin-Y <ykwhrimfaxi@gmail.com>
1 parent 31b11f1 commit 9507dbf

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)