--- # Optional: Monthly restore test automation apiVersion: batch/v1 kind: CronJob metadata: name: monthly-restore-test namespace: openshift-adp spec: schedule: "0 06 15 * *" # 15th of month, 6 AM concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 jobTemplate: spec: template: metadata: labels: app: restore-test spec: serviceAccountName: velero restartPolicy: OnFailure containers: - name: restore-test image: quay.io/konveyor/velero:latest env: - name: VELERO_NAMESPACE value: openshift-adp command: - /bin/bash - -c - | set -e echo "=== Velero Restore Test ===" echo "Date: $(date)" # Get latest daily-config backup CONFIG_BACKUP=$(velero backup get --selector="backup-type=config" \ -o json | jq -r '.items[0].metadata.name') # Get latest daily-stateful backup STATEFUL_BACKUP=$(velero backup get --selector="backup-type=stateful" \ -o json | jq -r '.items[0].metadata.name') echo "Latest config backup: $CONFIG_BACKUP" echo "Latest stateful backup: $STATEFUL_BACKUP" # Verify backups are successful CONFIG_STATUS=$(velero backup get $CONFIG_BACKUP -o json | \ jq -r '.status.phase') STATEFUL_STATUS=$(velero backup get $STATEFUL_BACKUP -o json | \ jq -r '.status.phase') echo "Config backup status: $CONFIG_STATUS" echo "Stateful backup status: $STATEFUL_STATUS" if [ "$CONFIG_STATUS" != "Completed" ] || [ "$STATEFUL_STATUS" != "Completed" ]; then echo "ERROR: Backups not in Completed state" exit 1 fi echo "=== Test Passed ===" echo "All backups verified successfully"