Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Improve demystifying GKE spot node preemtion #patch (#354)
Browse files Browse the repository at this point in the history
* Improve demystifying GKE spot node preemtion

Signed-off-by: Bernhard Stadlbauer <[email protected]>

* Add test

Signed-off-by: Bernhard Stadlbauer <[email protected]>

---------

Signed-off-by: Bernhard Stadlbauer <[email protected]>
  • Loading branch information
bstadlbauer authored May 26, 2023
1 parent 8a2f8ca commit c499a48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go/tasks/pluginmachinery/flytek8s/pod_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,9 @@ func DemystifyFailure(status v1.PodStatus, info pluginsCore.TaskInfo) (pluginsCo
// startTime: "2022-01-30T14:24:07Z"
// }
// }
if code == "Shutdown" {
//
// In some versions of GKE the reason can also be "Terminated"
if code == "Shutdown" || code == "Terminated" {
return pluginsCore.PhaseInfoSystemRetryableFailure(Interrupted, message, &info), nil
}

Expand Down
11 changes: 11 additions & 0 deletions go/tasks/pluginmachinery/flytek8s/pod_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,17 @@ func TestDemystifyFailure(t *testing.T) {
assert.Equal(t, "Interrupted", phaseInfo.Err().Code)
assert.Equal(t, core.ExecutionError_SYSTEM, phaseInfo.Err().Kind)
})

t.Run("GKE kubelet graceful node shutdown", func(t *testing.T) {
phaseInfo, err := DemystifyFailure(v1.PodStatus{
Message: "Foobar",
Reason: "Terminated",
}, 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)
})
}

func TestDemystifyPending_testcases(t *testing.T) {
Expand Down

0 comments on commit c499a48

Please sign in to comment.