Skip to content

Commit d048370

Browse files
committed
fix: avoid permanent diff in BackupConfiguration in SQLInstance
1 parent 0aa364b commit d048370

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/controller/direct/sql/sqlinstance_equality.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -303,19 +303,21 @@ func BackupConfigurationsMatch(desired *api.BackupConfiguration, actual *api.Bac
303303
if desired.PointInTimeRecoveryEnabled != actual.PointInTimeRecoveryEnabled {
304304
return false
305305
}
306-
// Ignore ReplicationLogArchivingEnabled. It is not supported in KRM API.
307-
if desired.StartTime != actual.StartTime {
306+
// Ignore StartTime if it is not set. empty string is not a valid start time.
307+
if desired.StartTime != "" && desired.StartTime != actual.StartTime {
308308
return false
309309
}
310-
if desired.TransactionLogRetentionDays != actual.TransactionLogRetentionDays {
310+
// Ignore TransactionLogRetentionDays if it is not set. 0 is not a valid transaction log retention days.
311+
if desired.TransactionLogRetentionDays != 0 && desired.TransactionLogRetentionDays != actual.TransactionLogRetentionDays {
311312
return false
312313
}
314+
315+
// Ignore ReplicationLogArchivingEnabled. It is not supported in KRM API.
313316
// Ignore TransactionalLogStorageState. It is not supported in KRM API.
314317
// Ignore ForceSendFields. Assume it is set correctly in desired.
315318
// Ignore NullFields. Assume it is set correctly in desired.
316319
return true
317320
}
318-
319321
func BackupRetentionSettingsMatch(desired *api.BackupRetentionSettings, actual *api.BackupRetentionSettings) bool {
320322
if desired == nil && actual == nil {
321323
return true

0 commit comments

Comments
 (0)