Skip to content

Commit ffa31c2

Browse files
egeguneshors
andauthored
K8SPSMDB-1344: Add size into backup status (#1939)
Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent 502e4e8 commit ffa31c2

File tree

8 files changed

+44
-0
lines changed

8 files changed

+44
-0
lines changed

config/crd/bases/psmdb.percona.com_perconaservermongodbbackups.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ spec:
3333
jsonPath: .status.type
3434
name: Type
3535
type: string
36+
- description: Backup size
37+
jsonPath: .status.size
38+
name: Size
39+
type: string
3640
- description: Job status
3741
jsonPath: .status.state
3842
name: Status
@@ -169,6 +173,8 @@ spec:
169173
required:
170174
- bucket
171175
type: object
176+
size:
177+
type: string
172178
start:
173179
format: date-time
174180
type: string

config/crd/bases/psmdb.percona.com_perconaservermongodbrestores.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ spec:
137137
required:
138138
- bucket
139139
type: object
140+
size:
141+
type: string
140142
start:
141143
format: date-time
142144
type: string

deploy/bundle.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ spec:
3737
jsonPath: .status.type
3838
name: Type
3939
type: string
40+
- description: Backup size
41+
jsonPath: .status.size
42+
name: Size
43+
type: string
4044
- description: Job status
4145
jsonPath: .status.state
4246
name: Status
@@ -173,6 +177,8 @@ spec:
173177
required:
174178
- bucket
175179
type: object
180+
size:
181+
type: string
176182
start:
177183
format: date-time
178184
type: string
@@ -332,6 +338,8 @@ spec:
332338
required:
333339
- bucket
334340
type: object
341+
size:
342+
type: string
335343
start:
336344
format: date-time
337345
type: string

deploy/crd.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ spec:
3737
jsonPath: .status.type
3838
name: Type
3939
type: string
40+
- description: Backup size
41+
jsonPath: .status.size
42+
name: Size
43+
type: string
4044
- description: Job status
4145
jsonPath: .status.state
4246
name: Status
@@ -173,6 +177,8 @@ spec:
173177
required:
174178
- bucket
175179
type: object
180+
size:
181+
type: string
176182
start:
177183
format: date-time
178184
type: string
@@ -332,6 +338,8 @@ spec:
332338
required:
333339
- bucket
334340
type: object
341+
size:
342+
type: string
335343
start:
336344
format: date-time
337345
type: string

deploy/cw-bundle.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ spec:
3737
jsonPath: .status.type
3838
name: Type
3939
type: string
40+
- description: Backup size
41+
jsonPath: .status.size
42+
name: Size
43+
type: string
4044
- description: Job status
4145
jsonPath: .status.state
4246
name: Status
@@ -173,6 +177,8 @@ spec:
173177
required:
174178
- bucket
175179
type: object
180+
size:
181+
type: string
176182
start:
177183
format: date-time
178184
type: string
@@ -332,6 +338,8 @@ spec:
332338
required:
333339
- bucket
334340
type: object
341+
size:
342+
type: string
335343
start:
336344
format: date-time
337345
type: string

e2e-tests/version-service/conf/crd.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ spec:
3737
jsonPath: .status.type
3838
name: Type
3939
type: string
40+
- description: Backup size
41+
jsonPath: .status.size
42+
name: Size
43+
type: string
4044
- description: Job status
4145
jsonPath: .status.state
4246
name: Status
@@ -173,6 +177,8 @@ spec:
173177
required:
174178
- bucket
175179
type: object
180+
size:
181+
type: string
176182
start:
177183
format: date-time
178184
type: string
@@ -332,6 +338,8 @@ spec:
332338
required:
333339
- bucket
334340
type: object
341+
size:
342+
type: string
335343
start:
336344
format: date-time
337345
type: string

pkg/apis/psmdb/v1/perconaservermongodbbackup_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type PerconaServerMongoDBBackupStatus struct {
4848
Filesystem *BackupStorageFilesystemSpec `json:"filesystem,omitempty"`
4949
ReplsetNames []string `json:"replsetNames,omitempty"`
5050
PBMname string `json:"pbmName,omitempty"`
51+
Size string `json:"size,omitempty"`
5152

5253
// Deprecated: Use PBMPods instead
5354
PBMPod string `json:"pbmPod,omitempty"`
@@ -67,6 +68,7 @@ type PerconaServerMongoDBBackupStatus struct {
6768
// +kubebuilder:printcolumn:name="Storage",type=string,JSONPath=".spec.storageName",description="Storage name"
6869
// +kubebuilder:printcolumn:name="Destination",type=string,JSONPath=".status.destination",description="Backup destination"
6970
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=".status.type",description="Backup type"
71+
// +kubebuilder:printcolumn:name="Size",type=string,JSONPath=".status.size",description="Backup size"
7072
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=".status.state",description="Job status"
7173
// +kubebuilder:printcolumn:name="Completed",type=date,JSONPath=".status.completed",description="Completed time"
7274
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp",description="Created time"

pkg/controller/perconaservermongodbbackup/backup.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/percona/percona-backup-mongodb/pbm/ctrl"
1717
"github.com/percona/percona-backup-mongodb/pbm/defs"
1818
pbmErrors "github.com/percona/percona-backup-mongodb/pbm/errors"
19+
"github.com/percona/percona-backup-mongodb/pbm/storage"
1920

2021
api "github.com/percona/percona-server-mongodb-operator/pkg/apis/psmdb/v1"
2122
"github.com/percona/percona-server-mongodb-operator/pkg/psmdb/backup"
@@ -192,6 +193,7 @@ func (b *Backup) Status(ctx context.Context, cr *api.PerconaServerMongoDBBackup)
192193
status.Error = "incremental base backup not found"
193194
}
194195
case defs.StatusDone:
196+
status.Size = storage.PrettySize(meta.Size)
195197
status.State = api.BackupStateReady
196198
status.CompletedAt = &metav1.Time{
197199
Time: time.Unix(meta.LastTransitionTS, 0),

0 commit comments

Comments
 (0)