Skip to content
Closed
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
11 changes: 2 additions & 9 deletions api/v1beta2/foundationdbbackup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,6 @@ func (backup *FoundationDBBackup) GetDesiredAgentCount() int {
return ptr.Deref(backup.Spec.AgentCount, 2)
}

// NeedsBackupReconfiguration determines if the backup needs to be reconfigured.
func (backup *FoundationDBBackup) NeedsBackupReconfiguration() bool {
hasSnapshotSecondsChanged := backup.SnapshotPeriodSeconds() != backup.Status.BackupDetails.SnapshotPeriodSeconds
hasBackupURLChanged := backup.BackupURL() != backup.Status.BackupDetails.URL

return hasSnapshotSecondsChanged || hasBackupURLChanged
}

// CheckReconciliation compares the spec and the status to determine if
// reconciliation is complete.
func (backup *FoundationDBBackup) CheckReconciliation() (bool, error) {
Expand Down Expand Up @@ -413,7 +405,8 @@ func (backup *FoundationDBBackup) CheckReconciliation() (bool, error) {
reconciled = false
}

if isRunning && backup.NeedsBackupReconfiguration() {
if isRunning &&
backup.SnapshotPeriodSeconds() != backup.Status.BackupDetails.SnapshotPeriodSeconds {
backup.Status.Generations.NeedsBackupReconfiguration = backup.Generation
reconciled = false
}
Expand Down
6 changes: 2 additions & 4 deletions api/v1beta2/foundationdbbackup_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ var _ = Describe("[api] FoundationDBBackup", func() {
},
Spec: FoundationDBBackupSpec{
AgentCount: &agentCount,
BlobStoreConfiguration: &BlobStoreConfiguration{
AccountName: "test@test-service",
},
},
Status: FoundationDBBackupStatus{
Generations: BackupGenerationStatus{
Expand All @@ -63,7 +60,7 @@ var _ = Describe("[api] FoundationDBBackup", func() {
AgentCount: 3,
DeploymentConfigured: true,
BackupDetails: &FoundationDBBackupStatusBackupDetails{
URL: "blobstore://test@test-service:443/sample-cluster?bucket=fdb-backups",
URL: "blobstore://test@test-service/sample-cluster?bucket=fdb-backups",
Running: true,
SnapshotPeriodSeconds: 864000,
},
Expand All @@ -72,6 +69,7 @@ var _ = Describe("[api] FoundationDBBackup", func() {
}

backup = createBackup()

result, err := backup.CheckReconciliation()
Expect(result).To(BeTrue())
Expect(err).NotTo(HaveOccurred())
Expand Down
23 changes: 1 addition & 22 deletions controllers/admin_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,36 +333,15 @@ var _ = Describe("admin_client_test", func() {
Context("with a modification to the snapshot time", func() {
BeforeEach(func() {
backup.Spec.SnapshotPeriodSeconds = ptr.To(20)
backup.Spec.BlobStoreConfiguration = &fdbv1beta2.BlobStoreConfiguration{
BackupName: "test-backup",
AccountName: "test",
}
Expect(mockAdminClient.ModifyBackup(backup)).NotTo(HaveOccurred())

})

It("should have modified the snapshot time", func() {
It("should mark the backup as stopped", func() {
Expect(
status.SnapshotIntervalSeconds,
).To(BeNumerically("==", backup.SnapshotPeriodSeconds()))
})
})

Context("with a modification to the backup url", func() {
BeforeEach(func() {
backup.Spec.BlobStoreConfiguration = &fdbv1beta2.BlobStoreConfiguration{
BackupName: "test-backup-2",
AccountName: "test",
}
Expect(mockAdminClient.ModifyBackup(backup)).NotTo(HaveOccurred())
})

It("should have modified the backup url", func() {
Expect(
status.DestinationURL,
).To(Equal("blobstore://test:443/test-backup-2?bucket=fdb-backups"))
})
})
})
})

Expand Down
3 changes: 1 addition & 2 deletions controllers/modify_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ func (s modifyBackup) reconcile(
return nil
}

// The modify command is only required for continuous backups.
if backup.NeedsBackupReconfiguration() &&
if backup.Status.BackupDetails.SnapshotPeriodSeconds != backup.SnapshotPeriodSeconds() ||
backup.GetBackupMode() == fdbv1beta2.BackupModeContinuous {
adminClient, err := r.adminClientForBackup(ctx, backup)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/technical_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ The `ToggleBackupPaused` subreconciler is responsible for pausing and unpausing

The `ModifyBackup` command ensures that any properties that can be configured on a live backup are configured to the values in the backup spec. This will run the `modify` command in `fdbbackup` to set the properties from the spec.

Currently, this only supports the `snapshotPeriodSeconds` and `url` property.
Currently, this only supports the `snapshotPeriodSeconds` property.

### UpdateBackupStatus (again)

Expand Down
2 changes: 0 additions & 2 deletions fdbclient/admin_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,6 @@ func (client *cliAdminClient) ModifyBackup(backup *fdbv1beta2.FoundationDBBackup
"modify",
"-s",
strconv.Itoa(backup.SnapshotPeriodSeconds()),
"-d",
backup.BackupURL(),
},
})

Expand Down
1 change: 0 additions & 1 deletion pkg/fdbadminclient/mock/admin_client_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,6 @@ func (client *AdminClient) ModifyBackup(backup *fdbv1beta2.FoundationDBBackup) e

currentBackup := client.Backups["default"]
currentBackup.SnapshotPeriodSeconds = backup.SnapshotPeriodSeconds()
currentBackup.URL = backup.BackupURL()
client.Backups["default"] = currentBackup
return nil
}
Expand Down