Skip to content

K8SPSMDB-1344: Add size into backup status #1939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -169,6 +173,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down
8 changes: 8 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -173,6 +177,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down Expand Up @@ -332,6 +338,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down
8 changes: 8 additions & 0 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -173,6 +177,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down Expand Up @@ -332,6 +338,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down
8 changes: 8 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -173,6 +177,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down Expand Up @@ -332,6 +338,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down
8 changes: 8 additions & 0 deletions e2e-tests/version-service/conf/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -173,6 +177,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down Expand Up @@ -332,6 +338,8 @@ spec:
required:
- bucket
type: object
size:
type: string
start:
format: date-time
type: string
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/psmdb/v1/perconaservermongodbbackup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/perconaservermongodbbackup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand Down
Loading