diff --git a/config/crd/bases/psmdb.percona.com_perconaservermongodbbackups.yaml b/config/crd/bases/psmdb.percona.com_perconaservermongodbbackups.yaml index c3c4314e5..927badfaf 100644 --- a/config/crd/bases/psmdb.percona.com_perconaservermongodbbackups.yaml +++ b/config/crd/bases/psmdb.percona.com_perconaservermongodbbackups.yaml @@ -33,6 +33,10 @@ spec: jsonPath: .status.type name: Type type: string + - description: Backup size + jsonPath: .status.size + name: Size + type: string - description: Job status jsonPath: .status.state name: Status @@ -169,6 +173,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string diff --git a/config/crd/bases/psmdb.percona.com_perconaservermongodbrestores.yaml b/config/crd/bases/psmdb.percona.com_perconaservermongodbrestores.yaml index 6261d0a41..3d89cd320 100644 --- a/config/crd/bases/psmdb.percona.com_perconaservermongodbrestores.yaml +++ b/config/crd/bases/psmdb.percona.com_perconaservermongodbrestores.yaml @@ -137,6 +137,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string diff --git a/deploy/bundle.yaml b/deploy/bundle.yaml index 4312065d7..b4eb345a8 100644 --- a/deploy/bundle.yaml +++ b/deploy/bundle.yaml @@ -37,6 +37,10 @@ spec: jsonPath: .status.type name: Type type: string + - description: Backup size + jsonPath: .status.size + name: Size + type: string - description: Job status jsonPath: .status.state name: Status @@ -173,6 +177,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string @@ -332,6 +338,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string diff --git a/deploy/crd.yaml b/deploy/crd.yaml index b41742a74..1a1d0a0b7 100644 --- a/deploy/crd.yaml +++ b/deploy/crd.yaml @@ -37,6 +37,10 @@ spec: jsonPath: .status.type name: Type type: string + - description: Backup size + jsonPath: .status.size + name: Size + type: string - description: Job status jsonPath: .status.state name: Status @@ -173,6 +177,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string @@ -332,6 +338,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string diff --git a/deploy/cw-bundle.yaml b/deploy/cw-bundle.yaml index debf6c4f9..d9e3938eb 100644 --- a/deploy/cw-bundle.yaml +++ b/deploy/cw-bundle.yaml @@ -37,6 +37,10 @@ spec: jsonPath: .status.type name: Type type: string + - description: Backup size + jsonPath: .status.size + name: Size + type: string - description: Job status jsonPath: .status.state name: Status @@ -173,6 +177,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string @@ -332,6 +338,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string diff --git a/e2e-tests/version-service/conf/crd.yaml b/e2e-tests/version-service/conf/crd.yaml index b41742a74..1a1d0a0b7 100644 --- a/e2e-tests/version-service/conf/crd.yaml +++ b/e2e-tests/version-service/conf/crd.yaml @@ -37,6 +37,10 @@ spec: jsonPath: .status.type name: Type type: string + - description: Backup size + jsonPath: .status.size + name: Size + type: string - description: Job status jsonPath: .status.state name: Status @@ -173,6 +177,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string @@ -332,6 +338,8 @@ spec: required: - bucket type: object + size: + type: string start: format: date-time type: string diff --git a/pkg/apis/psmdb/v1/perconaservermongodbbackup_types.go b/pkg/apis/psmdb/v1/perconaservermongodbbackup_types.go index 5702f801e..3feedb286 100644 --- a/pkg/apis/psmdb/v1/perconaservermongodbbackup_types.go +++ b/pkg/apis/psmdb/v1/perconaservermongodbbackup_types.go @@ -48,6 +48,7 @@ type PerconaServerMongoDBBackupStatus struct { Filesystem *BackupStorageFilesystemSpec `json:"filesystem,omitempty"` ReplsetNames []string `json:"replsetNames,omitempty"` PBMname string `json:"pbmName,omitempty"` + Size string `json:"size,omitempty"` // Deprecated: Use PBMPods instead PBMPod string `json:"pbmPod,omitempty"` @@ -67,6 +68,7 @@ type PerconaServerMongoDBBackupStatus struct { // +kubebuilder:printcolumn:name="Storage",type=string,JSONPath=".spec.storageName",description="Storage name" // +kubebuilder:printcolumn:name="Destination",type=string,JSONPath=".status.destination",description="Backup destination" // +kubebuilder:printcolumn:name="Type",type=string,JSONPath=".status.type",description="Backup type" +// +kubebuilder:printcolumn:name="Size",type=string,JSONPath=".status.size",description="Backup size" // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=".status.state",description="Job status" // +kubebuilder:printcolumn:name="Completed",type=date,JSONPath=".status.completed",description="Completed time" // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp",description="Created time" diff --git a/pkg/controller/perconaservermongodbbackup/backup.go b/pkg/controller/perconaservermongodbbackup/backup.go index 789380644..b7d8ef3e6 100644 --- a/pkg/controller/perconaservermongodbbackup/backup.go +++ b/pkg/controller/perconaservermongodbbackup/backup.go @@ -16,6 +16,7 @@ import ( "github.com/percona/percona-backup-mongodb/pbm/ctrl" "github.com/percona/percona-backup-mongodb/pbm/defs" pbmErrors "github.com/percona/percona-backup-mongodb/pbm/errors" + "github.com/percona/percona-backup-mongodb/pbm/storage" api "github.com/percona/percona-server-mongodb-operator/pkg/apis/psmdb/v1" "github.com/percona/percona-server-mongodb-operator/pkg/psmdb/backup" @@ -192,6 +193,7 @@ func (b *Backup) Status(ctx context.Context, cr *api.PerconaServerMongoDBBackup) status.Error = "incremental base backup not found" } case defs.StatusDone: + status.Size = storage.PrettySize(meta.Size) status.State = api.BackupStateReady status.CompletedAt = &metav1.Time{ Time: time.Unix(meta.LastTransitionTS, 0),