feat: allow targetImmediate without backupID by dnplkndll · Pull Request #10312 · cloudnative-pg/cloudnative-pg

@dnplkndll

When targetImmediate is set in bootstrap.recovery.recoveryTarget,
the operator now allows omitting backupID and automatically selects
the latest available backup from the catalog — the same behavior
already used when no recoveryTarget is specified.

Previously, backupID was required for all non-time-based recovery
targets (targetImmediate, targetName, targetXID). While this makes
sense for targetName and targetXID (where the operator cannot
determine which base backup is appropriate), targetImmediate has no
such ambiguity: it simply means "stop at the first consistent state
after restoring the base backup."

The barman-cloud catalog's FindBackupInfo() already handles this
case correctly — when backupID is empty and no time/LSN target is
set, it falls through to selecting the latest backup. The only
blocker was the admission webhook validation, which this commit
relaxes for the targetImmediate case only.

Closes cloudnative-pg#8031

Signed-off-by: Don Kendall <kendall@donkendall.com>