Skip to content

Commit d64f211

Browse files
author
Milla Samuel
committed
Revert "Modify Backup URL in Reconciler (#2347)"
This reverts commit b1e744e.
1 parent 1ebb6f1 commit d64f211

File tree

7 files changed

+7
-42
lines changed

7 files changed

+7
-42
lines changed

api/v1beta2/foundationdbbackup_types.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,6 @@ func (backup *FoundationDBBackup) GetDesiredAgentCount() int {
376376
return ptr.Deref(backup.Spec.AgentCount, 2)
377377
}
378378

379-
// NeedsBackupReconfiguration determines if the backup needs to be reconfigured.
380-
func (backup *FoundationDBBackup) NeedsBackupReconfiguration() bool {
381-
hasSnapshotSecondsChanged := backup.SnapshotPeriodSeconds() != backup.Status.BackupDetails.SnapshotPeriodSeconds
382-
hasBackupURLChanged := backup.BackupURL() != backup.Status.BackupDetails.URL
383-
384-
return hasSnapshotSecondsChanged || hasBackupURLChanged
385-
}
386-
387379
// CheckReconciliation compares the spec and the status to determine if
388380
// reconciliation is complete.
389381
func (backup *FoundationDBBackup) CheckReconciliation() (bool, error) {
@@ -413,7 +405,8 @@ func (backup *FoundationDBBackup) CheckReconciliation() (bool, error) {
413405
reconciled = false
414406
}
415407

416-
if isRunning && backup.NeedsBackupReconfiguration() {
408+
if isRunning &&
409+
backup.SnapshotPeriodSeconds() != backup.Status.BackupDetails.SnapshotPeriodSeconds {
417410
backup.Status.Generations.NeedsBackupReconfiguration = backup.Generation
418411
reconciled = false
419412
}

api/v1beta2/foundationdbbackup_types_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ var _ = Describe("[api] FoundationDBBackup", func() {
5252
},
5353
Spec: FoundationDBBackupSpec{
5454
AgentCount: &agentCount,
55-
BlobStoreConfiguration: &BlobStoreConfiguration{
56-
AccountName: "test@test-service",
57-
},
5855
},
5956
Status: FoundationDBBackupStatus{
6057
Generations: BackupGenerationStatus{
@@ -63,7 +60,7 @@ var _ = Describe("[api] FoundationDBBackup", func() {
6360
AgentCount: 3,
6461
DeploymentConfigured: true,
6562
BackupDetails: &FoundationDBBackupStatusBackupDetails{
66-
URL: "blobstore://test@test-service:443/sample-cluster?bucket=fdb-backups",
63+
URL: "blobstore://test@test-service/sample-cluster?bucket=fdb-backups",
6764
Running: true,
6865
SnapshotPeriodSeconds: 864000,
6966
},
@@ -72,6 +69,7 @@ var _ = Describe("[api] FoundationDBBackup", func() {
7269
}
7370

7471
backup = createBackup()
72+
7573
result, err := backup.CheckReconciliation()
7674
Expect(result).To(BeTrue())
7775
Expect(err).NotTo(HaveOccurred())

controllers/admin_client_test.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -333,36 +333,15 @@ var _ = Describe("admin_client_test", func() {
333333
Context("with a modification to the snapshot time", func() {
334334
BeforeEach(func() {
335335
backup.Spec.SnapshotPeriodSeconds = ptr.To(20)
336-
backup.Spec.BlobStoreConfiguration = &fdbv1beta2.BlobStoreConfiguration{
337-
BackupName: "test-backup",
338-
AccountName: "test",
339-
}
340336
Expect(mockAdminClient.ModifyBackup(backup)).NotTo(HaveOccurred())
341-
342337
})
343338

344-
It("should have modified the snapshot time", func() {
339+
It("should mark the backup as stopped", func() {
345340
Expect(
346341
status.SnapshotIntervalSeconds,
347342
).To(BeNumerically("==", backup.SnapshotPeriodSeconds()))
348343
})
349344
})
350-
351-
Context("with a modification to the backup url", func() {
352-
BeforeEach(func() {
353-
backup.Spec.BlobStoreConfiguration = &fdbv1beta2.BlobStoreConfiguration{
354-
BackupName: "test-backup-2",
355-
AccountName: "test",
356-
}
357-
Expect(mockAdminClient.ModifyBackup(backup)).NotTo(HaveOccurred())
358-
})
359-
360-
It("should have modified the backup url", func() {
361-
Expect(
362-
status.DestinationURL,
363-
).To(Equal("blobstore://test:443/test-backup-2?bucket=fdb-backups"))
364-
})
365-
})
366345
})
367346
})
368347

controllers/modify_backup.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ func (s modifyBackup) reconcile(
4141
return nil
4242
}
4343

44-
// The modify command is only required for continuous backups.
45-
if backup.NeedsBackupReconfiguration() &&
46-
backup.GetBackupMode() == fdbv1beta2.BackupModeContinuous {
44+
if backup.Status.BackupDetails.SnapshotPeriodSeconds != backup.SnapshotPeriodSeconds() || backup.GetBackupMode() == fdbv1beta2.BackupModeContinuous {
4745
adminClient, err := r.adminClientForBackup(ctx, backup)
4846
if err != nil {
4947
return &requeue{curError: err}

docs/manual/technical_design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ The `ToggleBackupPaused` subreconciler is responsible for pausing and unpausing
387387

388388
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.
389389

390-
Currently, this only supports the `snapshotPeriodSeconds` and `url` property.
390+
Currently, this only supports the `snapshotPeriodSeconds` property.
391391

392392
### UpdateBackupStatus (again)
393393

fdbclient/admin_client.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,6 @@ func (client *cliAdminClient) ModifyBackup(backup *fdbv1beta2.FoundationDBBackup
932932
"modify",
933933
"-s",
934934
strconv.Itoa(backup.SnapshotPeriodSeconds()),
935-
"-d",
936-
backup.BackupURL(),
937935
},
938936
})
939937

pkg/fdbadminclient/mock/admin_client_mock.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,6 @@ func (client *AdminClient) ModifyBackup(backup *fdbv1beta2.FoundationDBBackup) e
941941

942942
currentBackup := client.Backups["default"]
943943
currentBackup.SnapshotPeriodSeconds = backup.SnapshotPeriodSeconds()
944-
currentBackup.URL = backup.BackupURL()
945944
client.Backups["default"] = currentBackup
946945
return nil
947946
}

0 commit comments

Comments
 (0)