Repository navigation
Description
Describe the bug
When the Job behind a mariadb-operator Backup or Restore fails, the MariaDB driver ends the BackupJob or RestoreJob as Succeeded. For a backup it also creates a Cozystack Backup in phase Ready that points to storage with no archive in it.
The driver maps Complete=True to success and handles failure only as Complete=False with reason JobFailed. Operator never emits that combination, when the Job has Failed=True it sets Complete to True with reason JobFailed and message Failed (SetCompleteWithJob in mariadb-operator 25.10.2). The comment in mariadbtypes/types.go (JobFailed -> Status=False) has it backwards.
Environment
Cozystack v1.7.0, mariadb-operator 25.10.2. The driver code is the same on main (4087218).
To reproduce
- Create a MariaDB app and run a BackupJob with
cozy-default. It succeeds and<namespace>/<app>/backup.<timestamp>.gzip.sqlappears in the bucket. - Copy the strategy
cozy-default-mariadb, change onlyspec.template.storage.s3.bucketto a bucket that does not exist, bind it from a new BackupClass. - Run a BackupJob with that class.
Actual behaviour
Pod crash-loops with error pushing target backup ... Access Denied., the Job fails with BackoffLimitExceeded after about 3 minutes and the operator Backup shows
conditions:
- type: Complete
status: "True"
reason: JobFailed
message: FailedBackupJob goes to Succeeded with Ready=True, reason BackupCompleted. The Backup is created Ready, takenAt is the failure time and status.artifact.uri is under the missing bucket. Same when the dump itself fails (databases: [no_such_db] in the strategy gives mariadb-dump: Got error: 1049: "Unknown database"), so it is not only storage errors. No event and nothing in the driver log.
RestoreJob has the same shape: an operator Restore with Complete=True and reason JobFailed gives RestoreJob Succeeded, reason RestoreCompleted. A Plan on a schedule keeps producing "successful" backups with nothing behind them.
Expected behaviour
BackupJob ends Failed with the cause in the message and no Backup is created. RestoreJob ends Failed too.
The code is in internal/backupcontroller/mariadbstrategy_controller.go, lines 207 and 234 for backup and 573 and 588 for restore. Success branch never looks at cond.Reason and failure branch needs Status == False. I think Complete=True with JobFailed should be the terminal failure and success only for JobComplete.
PR #5015 edits the same function but not this mapping.
Activity
scooby87 commentedon Nov 12, 2026
Fixed by #5207.