Skip to main content

validate_restore

Function validate_restore 

Source
pub fn validate_restore(spec: &RestoreSpec) -> ValidationResult
Expand description

A Restore spec is internally consistent (ADR §3.6/§4.6 / ADR-0005 §9).

The externally-tagged RestoreSource/RestoreTarget enums already guarantee exactly one variant — that is a compile-time/serde invariant, not re-checked here (a Restore with no target now fails to deserialize entirely, ADR-0005 §9). We validate the cross-field rules the enums can’t express:

  • source.identity requires spec.repository (nothing else can derive it).
  • if target: pvc, the template must name the PVC (name non-empty).
  • target: populator forbids mover.inheritSecurityContextFrom: no workload pod exists at provision time to inherit from (ADR-0005 §9 / ADR §4.7) — point the user at moverDefaults / an explicit securityContext instead.