Skip to content

Commit 0fb24a2

Browse files
author
Mateus Oliveira
authored
fix: Show backup/restore progress in NAB/NAR status (#239)
Signed-off-by: Mateus Oliveira <[email protected]>
1 parent 5060d9e commit 0fb24a2

26 files changed

+2315
-19
lines changed

api/v1alpha1/nonadminbackup_types.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,68 @@ type VeleroDeleteBackupRequest struct {
7474
Namespace string `json:"namespace,omitempty"`
7575
}
7676

77+
// DataMoverDataUploads contains information of the related Velero DataUpload objects.
78+
type DataMoverDataUploads struct {
79+
// number of DataUploads related to this NonAdminBackup's Backup
80+
// +optional
81+
Total int `json:"total,omitempty"`
82+
83+
// number of DataUploads related to this NonAdminBackup's Backup in phase New
84+
// +optional
85+
New int `json:"new,omitempty"`
86+
87+
// number of DataUploads related to this NonAdminBackup's Backup in phase Accepted
88+
// +optional
89+
Accepted int `json:"accepted,omitempty"`
90+
91+
// number of DataUploads related to this NonAdminBackup's Backup in phase Prepared
92+
// +optional
93+
Prepared int `json:"prepared,omitempty"`
94+
95+
// number of DataUploads related to this NonAdminBackup's Backup in phase InProgress
96+
// +optional
97+
InProgress int `json:"inProgress,omitempty"`
98+
99+
// number of DataUploads related to this NonAdminBackup's Backup in phase Canceling
100+
// +optional
101+
Canceling int `json:"canceling,omitempty"`
102+
103+
// number of DataUploads related to this NonAdminBackup's Backup in phase Canceled
104+
// +optional
105+
Canceled int `json:"canceled,omitempty"`
106+
107+
// number of DataUploads related to this NonAdminBackup's Backup in phase Failed
108+
// +optional
109+
Failed int `json:"failed,omitempty"`
110+
111+
// number of DataUploads related to this NonAdminBackup's Backup in phase Completed
112+
// +optional
113+
Completed int `json:"completed,omitempty"`
114+
}
115+
116+
// FileSystemPodVolumeBackups contains information of the related Velero PodVolumeBackup objects.
117+
type FileSystemPodVolumeBackups struct {
118+
// number of PodVolumeBackups related to this NonAdminBackup's Backup
119+
// +optional
120+
Total int `json:"total,omitempty"`
121+
122+
// number of PodVolumeBackups related to this NonAdminBackup's Backup in phase New
123+
// +optional
124+
New int `json:"new,omitempty"`
125+
126+
// number of PodVolumeBackups related to this NonAdminBackup's Backup in phase InProgress
127+
// +optional
128+
InProgress int `json:"inProgress,omitempty"`
129+
130+
// number of PodVolumeBackups related to this NonAdminBackup's Backup in phase Failed
131+
// +optional
132+
Failed int `json:"failed,omitempty"`
133+
134+
// number of PodVolumeBackups related to this NonAdminBackup's Backup in phase Completed
135+
// +optional
136+
Completed int `json:"completed,omitempty"`
137+
}
138+
77139
// NonAdminBackupStatus defines the observed state of NonAdminBackup
78140
type NonAdminBackupStatus struct {
79141
// +optional
@@ -82,6 +144,12 @@ type NonAdminBackupStatus struct {
82144
// +optional
83145
VeleroDeleteBackupRequest *VeleroDeleteBackupRequest `json:"veleroDeleteBackupRequest,omitempty"`
84146

147+
// +optional
148+
DataMoverDataUploads *DataMoverDataUploads `json:"dataMoverDataUploads,omitempty"`
149+
150+
// +optional
151+
FileSystemPodVolumeBackups *FileSystemPodVolumeBackups `json:"fileSystemPodVolumeBackups,omitempty"`
152+
85153
// queueInfo is used to estimate how many backups are scheduled before the given VeleroBackup in the OADP namespace.
86154
// This number is not guaranteed to be accurate, but it should be close. It's inaccurate for cases when
87155
// Velero pod is not running or being restarted after Backup object were created.

api/v1alpha1/nonadminrestore_types.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,79 @@ type VeleroRestore struct {
4646
Namespace string `json:"namespace,omitempty"`
4747
}
4848

49+
// DataMoverDataDownloads contains information of the related Velero DataDownload objects.
50+
type DataMoverDataDownloads struct {
51+
// number of DataDownloads related to this NonAdminRestore's Restore
52+
// +optional
53+
Total int `json:"total,omitempty"`
54+
55+
// number of DataDownloads related to this NonAdminRestore's Restore in phase New
56+
// +optional
57+
New int `json:"new,omitempty"`
58+
59+
// number of DataDownloads related to this NonAdminRestore's Restore in phase Accepted
60+
// +optional
61+
Accepted int `json:"accepted,omitempty"`
62+
63+
// number of DataDownloads related to this NonAdminRestore's Restore in phase Prepared
64+
// +optional
65+
Prepared int `json:"prepared,omitempty"`
66+
67+
// number of DataDownloads related to this NonAdminRestore's Restore in phase InProgress
68+
// +optional
69+
InProgress int `json:"inProgress,omitempty"`
70+
71+
// number of DataDownloads related to this NonAdminRestore's Restore in phase Canceling
72+
// +optional
73+
Canceling int `json:"canceling,omitempty"`
74+
75+
// number of DataDownloads related to this NonAdminRestore's Restore in phase Canceled
76+
// +optional
77+
Canceled int `json:"canceled,omitempty"`
78+
79+
// number of DataDownloads related to this NonAdminRestore's Restore in phase Failed
80+
// +optional
81+
Failed int `json:"failed,omitempty"`
82+
83+
// number of DataDownloads related to this NonAdminRestore's Restore in phase Completed
84+
// +optional
85+
Completed int `json:"completed,omitempty"`
86+
}
87+
88+
// FileSystemPodVolumeRestores contains information of the related Velero PodVolumeRestore objects.
89+
type FileSystemPodVolumeRestores struct {
90+
// number of PodVolumeRestores related to this NonAdminRestore's Restore
91+
// +optional
92+
Total int `json:"total,omitempty"`
93+
94+
// number of PodVolumeRestores related to this NonAdminRestore's Restore in phase New
95+
// +optional
96+
New int `json:"new,omitempty"`
97+
98+
// number of PodVolumeRestores related to this NonAdminRestore's Restore in phase InProgress
99+
// +optional
100+
InProgress int `json:"inProgress,omitempty"`
101+
102+
// number of PodVolumeRestores related to this NonAdminRestore's Restore in phase Failed
103+
// +optional
104+
Failed int `json:"failed,omitempty"`
105+
106+
// number of PodVolumeRestores related to this NonAdminRestore's Restore in phase Completed
107+
// +optional
108+
Completed int `json:"completed,omitempty"`
109+
}
110+
49111
// NonAdminRestoreStatus defines the observed state of NonAdminRestore
50112
type NonAdminRestoreStatus struct {
51113
// +optional
52114
VeleroRestore *VeleroRestore `json:"veleroRestore,omitempty"`
53115

116+
// +optional
117+
DataMoverDataDownloads *DataMoverDataDownloads `json:"dataMoverDataDownloads,omitempty"`
118+
119+
// +optional
120+
FileSystemPodVolumeRestores *FileSystemPodVolumeRestores `json:"fileSystemPodVolumeRestores,omitempty"`
121+
54122
// queueInfo is used to estimate how many restores are scheduled before the given VeleroRestore in the OADP namespace.
55123
// This number is not guaranteed to be accurate, but it should be close. It's inaccurate for cases when
56124
// Velero pod is not running or being restarted after Restore object were created.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/openshift/oadp-operator/api/v1alpha1"
3131
"github.com/sirupsen/logrus"
3232
velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
33+
velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
3334
"go.uber.org/zap/zapcore"
3435
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3536
"k8s.io/apimachinery/pkg/runtime"
@@ -63,6 +64,8 @@ func init() {
6364
utilruntime.Must(nacv1alpha1.AddToScheme(scheme))
6465

6566
utilruntime.Must(velerov1.AddToScheme(scheme))
67+
68+
utilruntime.Must(velerov2alpha1.AddToScheme(scheme))
6669
// +kubebuilder:scaffold:scheme
6770
}
6871

config/crd/bases/oadp.openshift.io_nonadminbackups.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,72 @@ spec:
601601
- type
602602
type: object
603603
type: array
604+
dataMoverDataUploads:
605+
description: DataMoverDataUploads contains information of the related
606+
Velero DataUpload objects.
607+
properties:
608+
accepted:
609+
description: number of DataUploads related to this NonAdminBackup's
610+
Backup in phase Accepted
611+
type: integer
612+
canceled:
613+
description: number of DataUploads related to this NonAdminBackup's
614+
Backup in phase Canceled
615+
type: integer
616+
canceling:
617+
description: number of DataUploads related to this NonAdminBackup's
618+
Backup in phase Canceling
619+
type: integer
620+
completed:
621+
description: number of DataUploads related to this NonAdminBackup's
622+
Backup in phase Completed
623+
type: integer
624+
failed:
625+
description: number of DataUploads related to this NonAdminBackup's
626+
Backup in phase Failed
627+
type: integer
628+
inProgress:
629+
description: number of DataUploads related to this NonAdminBackup's
630+
Backup in phase InProgress
631+
type: integer
632+
new:
633+
description: number of DataUploads related to this NonAdminBackup's
634+
Backup in phase New
635+
type: integer
636+
prepared:
637+
description: number of DataUploads related to this NonAdminBackup's
638+
Backup in phase Prepared
639+
type: integer
640+
total:
641+
description: number of DataUploads related to this NonAdminBackup's
642+
Backup
643+
type: integer
644+
type: object
645+
fileSystemPodVolumeBackups:
646+
description: FileSystemPodVolumeBackups contains information of the
647+
related Velero PodVolumeBackup objects.
648+
properties:
649+
completed:
650+
description: number of PodVolumeBackups related to this NonAdminBackup's
651+
Backup in phase Completed
652+
type: integer
653+
failed:
654+
description: number of PodVolumeBackups related to this NonAdminBackup's
655+
Backup in phase Failed
656+
type: integer
657+
inProgress:
658+
description: number of PodVolumeBackups related to this NonAdminBackup's
659+
Backup in phase InProgress
660+
type: integer
661+
new:
662+
description: number of PodVolumeBackups related to this NonAdminBackup's
663+
Backup in phase New
664+
type: integer
665+
total:
666+
description: number of PodVolumeBackups related to this NonAdminBackup's
667+
Backup
668+
type: integer
669+
type: object
604670
phase:
605671
description: phase is a simple one high-level summary of the lifecycle
606672
of an NonAdminBackup.

0 commit comments

Comments
 (0)