Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[House keeping] include container statuses for all container exit errors #5161

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,9 +851,11 @@ func DemystifyFailure(status v1.PodStatus, info pluginsCore.TaskInfo) (pluginsCo
// }
// }
//

var isSystemError bool
// In some versions of GKE the reason can also be "Terminated"
if code == "Shutdown" || code == "Terminated" {
return pluginsCore.PhaseInfoSystemRetryableFailure(Interrupted, message, &info), nil
isSystemError = true
}

//
Expand Down Expand Up @@ -887,6 +889,11 @@ func DemystifyFailure(status v1.PodStatus, info pluginsCore.TaskInfo) (pluginsCo
}
}
}

if isSystemError {
return pluginsCore.PhaseInfoSystemRetryableFailure(Interrupted, message, &info), nil
}

return pluginsCore.PhaseInfoRetryableFailure(code, message, &info), nil
}

Expand Down
24 changes: 24 additions & 0 deletions flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1631,25 +1631,49 @@ func TestDemystifyFailure(t *testing.T) {
})

t.Run("GKE kubelet graceful node shutdown", func(t *testing.T) {
containerReason := "some reason"
phaseInfo, err := DemystifyFailure(v1.PodStatus{
Message: "Pod Node is in progress of shutting down, not admitting any new pods",
Reason: "Shutdown",
ContainerStatuses: []v1.ContainerStatus{
{
LastTerminationState: v1.ContainerState{
Terminated: &v1.ContainerStateTerminated{
Reason: containerReason,
ExitCode: SIGKILL,
},
},
},
},
}, pluginsCore.TaskInfo{})
assert.Nil(t, err)
assert.Equal(t, pluginsCore.PhaseRetryableFailure, phaseInfo.Phase())
assert.Equal(t, "Interrupted", phaseInfo.Err().Code)
assert.Equal(t, core.ExecutionError_SYSTEM, phaseInfo.Err().Kind)
assert.Contains(t, phaseInfo.Err().Message, containerReason)
})

t.Run("GKE kubelet graceful node shutdown", func(t *testing.T) {
containerReason := "some reason"
phaseInfo, err := DemystifyFailure(v1.PodStatus{
Message: "Foobar",
Reason: "Terminated",
ContainerStatuses: []v1.ContainerStatus{
{
LastTerminationState: v1.ContainerState{
Terminated: &v1.ContainerStateTerminated{
Reason: containerReason,
ExitCode: SIGKILL,
},
},
},
},
}, pluginsCore.TaskInfo{})
assert.Nil(t, err)
assert.Equal(t, pluginsCore.PhaseRetryableFailure, phaseInfo.Phase())
assert.Equal(t, "Interrupted", phaseInfo.Err().Code)
assert.Equal(t, core.ExecutionError_SYSTEM, phaseInfo.Err().Kind)
assert.Contains(t, phaseInfo.Err().Message, containerReason)
})
}

Expand Down
Loading