Skip to content

Commit

Permalink
Change completed to true when backup job failed. Fixes #350
Browse files Browse the repository at this point in the history
  • Loading branch information
bluven authored and AMecea committed Jun 25, 2019
1 parent 04c440a commit 24e7b81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config/crds/mysql_v1alpha1_mysqlbackup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ spec:
status:
properties:
completed:
description: Complete marks the backup in final state
description: Completed indicates whether the backup is in a final state,
no matter whether its' corresponding job failed or succeeded
type: boolean
conditions:
description: Conditions represents the backup resource conditions list.
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/mysql/v1alpha1/mysqlbackup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const (

// MysqlBackupStatus defines the observed state of MysqlBackup
type MysqlBackupStatus struct {
// Complete marks the backup in final state
// Completed indicates whether the backup is in a final state,
// no matter whether its' corresponding job failed or succeeded
Completed bool `json:"completed,omitempty"`
// Conditions represents the backup resource conditions list.
Conditions []BackupCondition `json:"conditions,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/mysqlbackup/internal/syncer/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func (s *jobSyncer) updateStatus(job *batch.Job) {
// check for failed condition
if cond := jobCondition(batch.JobFailed, job); cond != nil {
s.backup.UpdateStatusCondition(api.BackupFailed, cond.Status, cond.Reason, cond.Message)

if cond.Status == core.ConditionTrue {
s.backup.Status.Completed = true
}
}
}

Expand Down

0 comments on commit 24e7b81

Please sign in to comment.