Skip to content

Commit

Permalink
add check pod container size
Browse files Browse the repository at this point in the history
  • Loading branch information
lingdie committed Sep 18, 2024
1 parent ef59fb5 commit cf3ce72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/devbox/internal/controller/devbox_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ func (r *DevboxReconciler) syncPod(ctx context.Context, devbox *devboxv1alpha1.D
case 1:
pod := &podList.Items[0]
devbox.Status.DevboxPodPhase = pod.Status.Phase
// check pod container size, if it is 0, it means the pod is not running, return an error
if len(pod.Status.ContainerStatuses) == 0 {
devbox.Status.Phase = devboxv1alpha1.DevboxPhasePending
return fmt.Errorf("pod container size is 0")
}
devbox.Status.State = pod.Status.ContainerStatuses[0].State
// update commit predicated status by pod status, this should be done once find a pod
helper.UpdatePredicatedCommitStatus(devbox, pod)
Expand Down

0 comments on commit cf3ce72

Please sign in to comment.