Webhook icon
Schedule icon
Script icon
Docker icon
Loop icon
If icon
SlackIncomingWebhook icon
Log icon
Fail icon

Catch Velero Backup Schedule Gaps and Stale Restore Drills Before an Outage Needs Them

Age Velero backup schedules against their cadence, verify restore drill freshness from one webhook report, and fail the gate with Slack alerts.

Categories
Infrastructure

Velero reports that a schedule exists and is Enabled while that same schedule has not produced a Completed backup in a week, and a restore nobody attempted in months shows up during an incident rather than a drill. This blueprint turns the fleet's backup position into a gate. One webhook report carrying the schedules, the backups and the drill results is aged in Python against each schedule's own cadence, a Loop announces every gapped schedule on Slack with its real age, and the gate fails when a gap exists, when drill evidence is stale, or when the report cannot be parsed at all.

How it works

  1. post_backup_report (io.kestra.plugin.core.trigger.Webhook, keyed with the VELERO_REPORT_WEBHOOK_KEY secret) accepts the report from the cluster collector. daily_gap_safety_net (io.kestra.plugin.core.trigger.Schedule, cron 0 5 * * *) ships disabled: true until an operator has reviewed the three cadence inputs and switched it on.
  2. analyze_backup_report (io.kestra.plugin.scripts.python.Script on python:3.12-slim) materializes the posted body as velero_report.json through inputFiles and reads the thresholds from env, keeping the script free of template placeholders. It indexes the newest Completed backup per schedule from the Velero labels, ages each schedule against cadenceHours + gap_tolerance_hours, checks every drill against restore_drill_max_age_days, and prints one ::{"outputs": ...}:: line. A schedule with no Completed backup on record is a gap, and an unreadable report is UNREADABLE_REPORT.
  3. walk_schedules (io.kestra.plugin.core.flow.Loop, concurrencyLimit: 1) walks the schedule entries and gap_check (io.kestra.plugin.core.flow.If) branches on the gapped flag of the current item. Gapped schedules get one Slack message each with their reason and last Completed backup, on cadence schedules are only logged, so one loud schedule never hides a quiet one.
  4. restore_drill_gate (io.kestra.plugin.core.flow.If) is the verdict. When blocked it posts the summary to Slack and then calls io.kestra.plugin.core.execution.Fail, so a promotion pipeline waiting on this execution stops too; when healthy it logs the schedule count and the oldest backup age. The flow level errors handler (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) reports any failure outside the gate logic with the execution id.

What you get

  • A per schedule age against that schedule's own cadence, not one global threshold that is wrong for half the fleet.
  • Restore drill evidence as a first class gate condition, including the case where no drill has ever been recorded.
  • A fail safe posture, an unreadable or empty report blocks the run instead of passing it.
  • Gateable outputs (verdict, gate_blocked, gaps_detected, gapped_schedules, oldest_backup_age_hours, restore_drill_ok) that a parent release flow can branch on, plus one Slack message per gapped schedule and a quiet log when all is in cadence.

Who it's for

  • Platform and SRE teams who own cluster backups and cannot remember when each Velero schedule last produced a Completed backup.
  • Disaster recovery owners who need proof that restore drills are happening instead of a wiki page claiming they are.
  • Release engineers who want a promotion to stop when a cluster's backup position has quietly rotted.

Why orchestrate this with Kestra

Velero gives you schedules, backups and restores as three separate objects and no opinion about whether they still line up. Kestra holds the comparison in one version controlled file, the keyed webhook the collector calls, the disabled schedule as the safety net, the loop that pages per schedule, the conditional verdict that separates escalation from the all clear, typed outputs a downstream flow can branch on, and an execution history that proves the check ran at 05:00 even when nobody looked. The alternative is a cron script whose output nobody reads until the restore fails.

Prerequisites

  • A worker with Docker access, the analysis runs in python:3.12-slim.
  • A Velero installation and a collector step that POSTs velero backup get style output together with drill results, shaped as schedules, backups and restoreDrills.
  • A Slack incoming webhook for gap alerts, the blocked summary and failures.
  • An observedAt timestamp in the report, UTC, so ages are reproducible. When it is missing the script falls back to the current time.

Secrets

  • VELERO_REPORT_WEBHOOK_KEY: key segment guarding the report webhook URL, anyone holding it can post a backup report.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL used by the per schedule alerts, the blocked summary and the errors handler.

Quick start

  1. Add both secrets to your Kestra namespace and confirm the worker runs python:3.12-slim containers.

  2. Run the flow once with a sample report to watch the gate fail on purpose.

    curl -X POST -H "Content-Type: application/json" -d '{"observedAt":"2026-10-15T06:00:00Z","schedules":[{"name":"daily-app-backup","cadenceHours":24}],"backups":[{"metadata":{"labels":{"velero.io/schedule-name":"daily-app-backup"}},"status":{"phase":"Completed","startTimestamp":"2026-10-13T02:00:00Z"}}],"restoreDrills":[{"name":"payments-restore","lastSuccess":"2026-10-01T09:00:00Z"}]}' "https://<kestra>/api/v1/<tenant>/executions/webhook/<namespace>/velero-backup-schedule-gap-and-restore-check/<VELERO_REPORT_WEBHOOK_KEY>"
    

    The daily backup is 52h old against a 30h window, so the run reports BLOCKED, posts that schedule and fails.

  3. Re-post the same report with the backup moved to 2026-10-15T02:00:00Z to watch the same run report HEALTHY.

  4. Point your collector at that webhook URL and let it fire after each backup window, then set disabled: false on daily_gap_safety_net so a collector outage still leaves a daily net in place.

How to extend

  • Replace the webhook body with a io.kestra.plugin.core.http.Request that reads the Velero server API directly with a bearer token, keeping the webhook path as the offline fallback for clusters that cannot expose the API.
  • Fan the check out per cluster with io.kestra.plugin.core.flow.Loop over a cluster list, each subflow posting its own report, and roll the per cluster verdicts up in a parent.
  • Keep the last known good report in the Kestra KV store and compare against it, so a schedule that disappears from the report entirely is caught instead of silently skipped.
  • Archive each posted report with io.kestra.plugin.aws.s3.Upload to build a long term backup evidence trail for audits.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.