fix: remove `Backup` owner field indexer from `ScheduledBackup` controller by andrew-farries · Pull Request #9466 · cloudnative-pg/cloudnative-pg

@andrew-farries

Remove the indexer on Backup resources that allowed finding all Backups
owned by a ScheduledBackup.

The indexer never worked because it was checking for owners of kind
`Backup` instead of `ScheduledBackup`.

Even if it had correctly looked for owners of kind `ScheduledBackup`, it
would only have worked for the cases where the `ScheduledBackup` was
configured with:

```
backupOwnerReference: self
```

When `backupOwnerReference` is set to `none` (the default) or `cluster`
this indexer would not have indexed anything.

The Backup controller handles concurrency by itself by checking for
running Backups before starting a new one, so rather than fixing this indexer
we simply remove it.

Signed-off-by: Andrew Farries <andrew.farries@xata.io>

armru added a commit that referenced this pull request

Dec 18, 2025
…ed indexer

The ScheduledBackup controller was using a broken field indexer on owner references
to find child Backups for concurrency checking. The indexer checked for the wrong
owner kind, making it non-functional.

This fix replaces the owner reference-based indexer with a more robust approach:
a field indexer on the ParentScheduledBackupLabel that is already set on all backups
created by ScheduledBackup. This label is always present regardless of the
backupOwnerReference configuration.

Closes #9466

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>

@armru armru mentioned this pull request

Dec 18, 2025

mnencia pushed a commit that referenced this pull request

Dec 22, 2025
…ed indexer

The ScheduledBackup controller was using a broken field indexer on owner references
to find child Backups for concurrency checking. The indexer checked for the wrong
owner kind, making it non-functional.

This fix replaces the owner reference-based indexer with a more robust approach:
a field indexer on the ParentScheduledBackupLabel that is already set on all backups
created by ScheduledBackup. This label is always present regardless of the
backupOwnerReference configuration.

Closes #9466

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>

leonardoce pushed a commit that referenced this pull request

Dec 23, 2025
…ed indexer

The ScheduledBackup controller was using a broken field indexer on owner references
to find child Backups for concurrency checking. The indexer checked for the wrong
owner kind, making it non-functional.

This fix replaces the owner reference-based indexer with a more robust approach:
a field indexer on the ParentScheduledBackupLabel that is already set on all backups
created by ScheduledBackup. This label is always present regardless of the
backupOwnerReference configuration.

Closes #9466

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>