Skip to content
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

EVEREST-1625 Fix PITR options are not available #667

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions api/v1alpha1/databasecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ type BackupSchedule struct {
// Backup is the backup configuration.
type Backup struct {
// Enabled is a flag to enable backups
// Deprecated. Please use db.spec.backup.schedules[].enabled to control each schedule separately and db.spec.backup.pitr.enabled to control PITR.
Enabled bool `json:"enabled"`
// Schedules is a list of backup schedules
Schedules []BackupSchedule `json:"schedules,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ metadata:
}
]
capabilities: Basic Install
createdAt: "2025-01-21T11:40:01Z"
createdAt: "2025-02-14T15:05:36Z"
operators.operatorframework.io/builder: operator-sdk-v1.38.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
name: everest-operator.v0.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ spec:
description: Backup is the backup specification
properties:
enabled:
description: Enabled is a flag to enable backups
description: |-
Enabled is a flag to enable backups
Deprecated. Please use db.spec.backup.schedules[].enabled to control each schedule separately and db.spec.backup.pitr.enabled to control PITR.
type: boolean
pitr:
description: PITR is the configuration of the point in time recovery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ spec:
description: Backup is the backup specification
properties:
enabled:
description: Enabled is a flag to enable backups
description: |-
Enabled is a flag to enable backups
Deprecated. Please use db.spec.backup.schedules[].enabled to control each schedule separately and db.spec.backup.pitr.enabled to control PITR.
type: boolean
pitr:
description: PITR is the configuration of the point in time recovery
Expand Down
4 changes: 3 additions & 1 deletion deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ spec:
description: Backup is the backup specification
properties:
enabled:
description: Enabled is a flag to enable backups
description: |-
Enabled is a flag to enable backups
Deprecated. Please use db.spec.backup.schedules[].enabled to control each schedule separately and db.spec.backup.pitr.enabled to control PITR.
type: boolean
pitr:
description: PITR is the configuration of the point in time recovery
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/databasecluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func (r *DatabaseClusterReconciler) initIndexers(ctx context.Context, mgr ctrl.M
func(o client.Object) []string {
var res []string
database, ok := o.(*everestv1alpha1.DatabaseCluster)
if !ok || !database.Spec.Backup.Enabled {
if !ok {
return res
}
for _, storage := range database.Spec.Backup.Schedules {
Expand Down
7 changes: 2 additions & 5 deletions internal/controller/providers/pg/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,11 +951,8 @@ func (p *applier) reconcilePGBackupsSpec() (pgv2.Backups, error) {
return pgv2.Backups{}, err
}

// Only use the backup schedules if schedules are enabled in the DBC spec
backupSchedules := []everestv1alpha1.BackupSchedule{}
if database.Spec.Backup.Enabled {
backupSchedules = database.Spec.Backup.Schedules
}
backupSchedules := database.Spec.Backup.Schedules

// Add backup storages used by backup schedules to the list
if err := p.addBackupStoragesBySchedules(backupSchedules, backupStorages, backupStoragesSecrets); err != nil {
return pgv2.Backups{}, err
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/providers/psmdb/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ func (p *applier) genPSMDBBackupSpec() (psmdbv1.BackupSpec, error) {
return emptySpec, err
}

// If scheduled backups are disabled, just return the storages used in
// If there are no schedules, just return the storages used in
// DatabaseClusterBackup objects
if !database.Spec.Backup.Enabled {
if len(database.Spec.Backup.Schedules) == 0 {
if len(storages) > 1 {
return emptySpec, common.ErrPSMDBOneStorageRestriction
}
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/providers/pxc/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ func (p *applier) genPXCBackupSpec() (*pxcv1.PXCScheduledBackup, error) {
}
}

// If scheduled backups are disabled, just return the storages used in DatabaseClusterBackup objects
if !database.Spec.Backup.Enabled {
// If there are no schedules, just return the storages used in DatabaseClusterBackup objects
if len(database.Spec.Backup.Schedules) == 0 {
pxcBackupSpec.Storages = storages
return pxcBackupSpec, nil
}
Expand Down
Loading