mirror of https://github.com/k3s-io/k3s
Merge pull request #65567 from ceshihao/pod_status_after_eviction
Pod status should contain ContainerStatuses if deadline exceededpull/58/head
commit
e85cb406eb
|
@ -1323,19 +1323,18 @@ func getPhase(spec *v1.PodSpec, info []v1.ContainerStatus) v1.PodPhase {
|
|||
func (kl *Kubelet) generateAPIPodStatus(pod *v1.Pod, podStatus *kubecontainer.PodStatus) v1.PodStatus {
|
||||
glog.V(3).Infof("Generating status for %q", format.Pod(pod))
|
||||
|
||||
s := kl.convertStatusToAPIStatus(pod, podStatus)
|
||||
|
||||
// check if an internal module has requested the pod is evicted.
|
||||
for _, podSyncHandler := range kl.PodSyncHandlers {
|
||||
if result := podSyncHandler.ShouldEvict(pod); result.Evict {
|
||||
return v1.PodStatus{
|
||||
Phase: v1.PodFailed,
|
||||
Reason: result.Reason,
|
||||
Message: result.Message,
|
||||
}
|
||||
s.Phase = v1.PodFailed
|
||||
s.Reason = result.Reason
|
||||
s.Message = result.Message
|
||||
return *s
|
||||
}
|
||||
}
|
||||
|
||||
s := kl.convertStatusToAPIStatus(pod, podStatus)
|
||||
|
||||
// Assume info is ready to process
|
||||
spec := &pod.Spec
|
||||
allStatus := append(append([]v1.ContainerStatus{}, s.ContainerStatuses...), s.InitContainerStatuses...)
|
||||
|
|
|
@ -1432,6 +1432,8 @@ func TestSyncPodsSetStatusToFailedForPodsThatRunTooLong(t *testing.T) {
|
|||
status, found := kubelet.statusManager.GetPodStatus(pods[0].UID)
|
||||
assert.True(t, found, "expected to found status for pod %q", pods[0].UID)
|
||||
assert.Equal(t, v1.PodFailed, status.Phase)
|
||||
// check pod status contains ContainerStatuses, etc.
|
||||
assert.NotNil(t, status.ContainerStatuses)
|
||||
}
|
||||
|
||||
func TestSyncPodsDoesNotSetPodsThatDidNotRunTooLongToFailed(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue