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

Change app status to rollback on job start timeout #298

Merged
merged 4 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion pkg/controller/flinkapplication/flink_state_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ func (s *FlinkStateMachine) handleSubmittingJob(ctx context.Context, app *v1beta
if err != nil {
logger.Info(ctx, "Job monitoring failed with error: %v", err)
s.flinkController.LogEvent(ctx, app, corev1.EventTypeWarning, "JobMonitoringFailed", err.Error())
return statusUnchanged, err
s.updateApplicationPhase(app, v1beta1.FlinkApplicationRollingBackJob)
avneet15 marked this conversation as resolved.
Show resolved Hide resolved
return statusChanged, err
}
if jobStarted {
return updateJobAndReturn(ctx, s, app, hash)
Expand Down
14 changes: 10 additions & 4 deletions pkg/controller/flinkapplication/flink_state_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,12 +760,15 @@ func TestSubmittingVertexFailsToStart(t *testing.T) {
if statusUpdateCount == 1 {
application := object.(*v1beta1.FlinkApplication)
assert.Equal(t, jobID, mockFlinkController.GetLatestJobID(ctx, application))
assert.Equal(t, v1beta1.FlinkApplicationRollingBackJob, application.Status.Phase)
} else if statusUpdateCount == 2 {
application := object.(*v1beta1.FlinkApplication)
assert.Equal(t, "", mockFlinkController.GetLatestJobID(ctx, application))
assert.Equal(t, jobID, mockFlinkController.GetLatestJobID(ctx, application))
assert.Equal(t, v1beta1.FlinkApplicationDeployFailed, application.Status.Phase)
} else if statusUpdateCount == 3 {
application := object.(*v1beta1.FlinkApplication)
assert.Equal(t, v1beta1.FlinkApplicationRollingBackJob, application.Status.Phase)
assert.Equal(t, v1beta1.FlinkApplicationDeployFailed, application.Status.Phase)
assert.Equal(t, jobID, mockFlinkController.GetLatestJobID(ctx, application))
}
statusUpdateCount++
return nil
Expand Down Expand Up @@ -926,12 +929,15 @@ func TestSubmittingVertexStartTimeout(t *testing.T) {
if statusUpdateCount == 1 {
application := object.(*v1beta1.FlinkApplication)
assert.Equal(t, jobID, mockFlinkController.GetLatestJobID(ctx, application))
assert.Equal(t, v1beta1.FlinkApplicationRollingBackJob, application.Status.Phase)
} else if statusUpdateCount == 2 {
application := object.(*v1beta1.FlinkApplication)
assert.Equal(t, "", mockFlinkController.GetLatestJobID(ctx, application))
assert.Equal(t, jobID, mockFlinkController.GetLatestJobID(ctx, application))
assert.Equal(t, v1beta1.FlinkApplicationDeployFailed, application.Status.Phase)
} else if statusUpdateCount == 3 {
application := object.(*v1beta1.FlinkApplication)
assert.Equal(t, v1beta1.FlinkApplicationRollingBackJob, application.Status.Phase)
assert.Equal(t, "", mockFlinkController.GetLatestJobID(ctx, application))
assert.Equal(t, v1beta1.FlinkApplicationDeployFailed, application.Status.Phase)
}
statusUpdateCount++
return nil
Expand Down
Loading