Skip to content

Commit 9e7f9fe

Browse files
committed
fix: check workspace pod for unschedulable condition
Fix devfile#977 Signed-off-by: Andrew Obuchowicz <[email protected]>
1 parent ddcbb2e commit 9e7f9fe

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/library/status/check.go

+17
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ func CheckPodsState(workspaceID string, namespace string, labelSelector k8sclien
9696
if msg, err := CheckPodEvents(&pod, workspaceID, ignoredEvents, clusterAPI); err != nil || msg != "" {
9797
return msg, err
9898
}
99+
if pod.Status.Phase == corev1.PodPending {
100+
if msg := checkPodConditions(&pod); msg != "" {
101+
return msg, nil
102+
}
103+
}
104+
99105
}
100106
return "", nil
101107
}
@@ -164,3 +170,14 @@ func checkIfUnrecoverableEventIgnored(reason string, ignoredEvents []string) (ig
164170
}
165171
return false
166172
}
173+
174+
func checkPodConditions(pod *corev1.Pod) (msg string) {
175+
if pod.Status.Conditions != nil {
176+
for _, condition := range pod.Status.Conditions {
177+
if condition.Type == corev1.PodScheduled && condition.Status == corev1.ConditionFalse && condition.Reason == corev1.PodReasonUnschedulable {
178+
return fmt.Sprintf("Pod is unschedulable: %s", condition.Message)
179+
}
180+
}
181+
}
182+
return ""
183+
}

0 commit comments

Comments
 (0)