Skip to content

Commit

Permalink
Merge pull request #670 from acekingke/fixFailJobToColumn
Browse files Browse the repository at this point in the history
api,backup: add printcolumn for Success #668
  • Loading branch information
acekingke authored Aug 26, 2022
2 parents a328257 + d757a39 commit 8b38896
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/backup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type BackupStatus struct {
// +kubebuilder:printcolumn:name="BackupName",type="string",JSONPath=".status.backupName",description="The Backup name"
// +kubebuilder:printcolumn:name="BackupDate",type="string",JSONPath=".status.backupDate",description="The Backup Date time"
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".status.backupType",description="The Backup Type"
// +kubebuilder:printcolumn:name="Success",type="string",JSONPath=".status.conditions[?(@.type==\"Complete\")].status",description="Whether the backup Success?"
// Backup is the Schema for the backups API
type Backup struct {
metav1.TypeMeta `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions backup/syncer/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func (s *jobSyncer) updateStatus(job *batchv1.Job) {
// check for failed condition
if cond := jobCondition(batchv1.JobFailed, job); cond != nil {
s.backup.UpdateStatusCondition(v1alpha1.BackupFailed, cond.Status, cond.Reason, cond.Message)
s.backup.UpdateStatusCondition(v1alpha1.BackupComplete, corev1.ConditionFalse, cond.Reason, cond.Message)
if cond.Status == corev1.ConditionTrue {
s.backup.Status.Completed = true
}
Expand Down
4 changes: 4 additions & 0 deletions charts/mysql-operator/crds/mysql.radondb.com_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
jsonPath: .status.backupType
name: Type
type: string
- description: Whether the backup Success?
jsonPath: .status.conditions[?(@.type=="Complete")].status
name: Success
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/mysql.radondb.com_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
jsonPath: .status.backupType
name: Type
type: string
- description: Whether the backup Success?
jsonPath: .status.conditions[?(@.type=="Complete")].status
name: Success
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down

0 comments on commit 8b38896

Please sign in to comment.