assay.velero
Velero backup and restore. Backups, restores, schedules, storage locations. Client:
velero.client(url, token, namespace?). Default namespace: "velero".
Backups
c.backups:list()-> [backup] -- List all backupsc.backups:get(name)-> backup|nil -- Get backup by namec.backups:status(name)->{phase, started, completed, expiration, errors, warnings, items_backed_up, items_total}-- Get statusc.backups:is_completed(name)-> bool -- Check if backup phase is "Completed"c.backups:is_failed(name)-> bool -- Check if backup phase is "Failed" or "PartiallyFailed"c.backups:latest(schedule_name)-> backup|nil -- Get most recent backup for a schedule
Restores
c.restores:list()-> [restore] -- List all restoresc.restores:get(name)-> restore|nil -- Get restore by namec.restores:status(name)->{phase, started, completed, errors, warnings}-- Get restore statusc.restores:is_completed(name)-> bool -- Check if restore phase is "Completed"
Schedules
c.schedules:list()-> [schedule] -- List all schedulesc.schedules:get(name)-> schedule|nil -- Get schedule by namec.schedules:status(name)->{phase, last_backup, validation_errors}-- Get schedule statusc.schedules:is_enabled(name)-> bool -- Check if schedule phase is "Enabled"c.schedules:all_enabled()->{enabled, disabled, total, disabled_names}-- Check all schedules
Storage Locations
c.storage_locations:list()-> [bsl] -- List backup storage locationsc.storage_locations:get(name)-> bsl|nil -- Get backup storage locationc.storage_locations:is_available(name)-> bool -- Check if storage location phase is "Available"c.storage_locations:all_available()->{available, unavailable, total, unavailable_names}-- Check all storage locations
Volume Snapshots
c.volume_snapshots:list()-> [vsl] -- List volume snapshot locationsc.volume_snapshots:get(name)-> vsl|nil -- Get volume snapshot location
Backup Repositories
c.repositories:list()-> [repo] -- List backup repositoriesc.repositories:get(name)-> repo|nil -- Get backup repository
Example:
local velero = require("assay.velero")
local c = velero.client("https://k8s-api:6443", env.get("K8S_TOKEN"), "velero")
local latest = c.backups:latest("daily-backup")
if latest then
assert.eq(c.backups:is_completed(latest.metadata.name), true)
end