Skip to main content

Module snapshot_policy

Module snapshot_policy 

Source
Expand description

The SnapshotPolicy CRD — the recipe. Idempotent; runs nothing on its own. ADR-0001 §3.3, ADR-0003 §4.8.

Structs§

AdoptionSummary
Summary of the most recent automatic adoption pass for a SnapshotPolicy — discovered snapshots whose resolved identity matched this recipe and were re-attached (see Origin::Adopted), plus an on-demand re-scan request/ack pair mirroring the repository-level catalog-scan-requested-at annotation contract.
Compression
Compression policy.
DeepVerification
Deep (scratch-restore) verification: restore the latest snapshot into an ephemeral volume, then discard.
ErrorHandling
Backup-side error-handling policy: let kopia complete a snapshot with errors rather than aborting.
Files
File-ignore policy.
Hooks
Pre/post snapshot hook lists.
HttpHeader
One HTTP header sent with an httpRequest hook.
HttpRequestHook
A hook that issues an HTTP request for cross-system orchestration.
NamespaceSelector
Restricts a PvcSelector to an explicit set of namespaces.
PolicyDeletionSpec
Deletion semantics for the Snapshots carrying a SnapshotPolicy’s config label (sub-object per docs/dev/api-conventions.md §4 so future deletion knobs slot in without API breakage). Mirrors SnapshotSchedule’s ScheduleDeletionSpec.
PvcSelector
Selects PVCs across namespaces by label.
PvcSource
A single backup source addressed by PVC name.
QuickVerification
Quick (blob-level) verification tier: schedule for the frequent kopia snapshot verify.
RepoVerification
One repository’s verification record on a multi-repository policy (status.verification). Entry-keyed by the (normalized) repository ref so per-repo verify results never collapse into one flat timestamp.
ResolvedPolicy
The recipe as kopia would see it, pinned at admission and never re-rendered.
ResolvedPolicyRepository
One member repository’s resolution within a multi-repository policy: which repository, and what kopia identity this policy resolves to under that repository’s identityDefaults. Consumed by the admission fork guard as the per-repo baseline (repo_key → previously-resolved identity), so an edit that would re-identify ONE member’s lineage is caught even though the other members are unaffected.
ResolvedPolicySource
One resolved source — a concrete PVC and the path kopia records for it.
RetentionSummary
Summary of the most recent GFS retention prune for a SnapshotPolicy.
RunJobHook
A hook that materializes a full one-shot Job (k8up PreBackupPod analog).
SnapshotPolicy
Auto-generated derived type for SnapshotPolicySpec via CustomResource
SnapshotPolicySpec
What to back up: sources, identity, retention, policy, hooks.
SnapshotPolicyStatus
Observed state of a SnapshotPolicy.
Source
A single backup source; exactly one of pvc, pvcSelector, nfs (webhook-enforced).
StagingSpec
SnapshotPolicy.spec.staging — knobs for the CSI capture (copyMethod: Snapshot/Clone) that runs before the mover. A sub-object so future staging fields slot in without API breakage.
Upload
Upload parallelism (kopia’s upload policy); absent knobs leave kopia’s default.
Verification
First-class backup verification proving snapshots are restorable; opt-in, with quick and deep tiers.
WorkloadExecHook
kubectl exec-style hook into a matched workload pod/container.

Enums§

CopyMethod
Volume snapshot copy method. Closed enum. ADR §3.3.
GroupBy
Multi-PVC grouping strategy. Defaults to a consistent group snapshot across all PVCs; set None explicitly to accept independent per-PVC snapshots, because a silent per-PVC fallback would produce inconsistent backups.
Hook
One of three hook forms. Externally-tagged: the wire shape is { workloadExec: {...} }, { runJob: {...} }, or { httpRequest: {...} }, and exactly one form is present.
PolicyRepositories
The repository target(s) of a SnapshotPolicy, as an exactly-one-of view over spec.repository / spec.repositories. Borrowed so consumers match without cloning; produced by policy_repositories.
SourcePathStrategy
How a selector-matched PVC’s source path is derived. Only relevant for pvcSelector sources, where one recipe expands to many PVCs and each needs a distinct kopia source path. Defaults to PvcName.

Functions§

default_ignore_rules
The default OS-artifact exclude set for Files.ignore_rules — filesystem/NAS junk that is never intentional user data, so excluding it by default is additive-safe. Per-entry rationale:
effective_on_policy_delete
The effective cascade policy for a SnapshotPolicy: spec.deletion.onPolicyDelete when the sub-object is present, else Retain. (A default nested under an ABSENT optional sub-object does not materialize server-side — every read goes through this resolver.)
is_multi_repo
Whether this policy uses the multi-repository fan-out shape.
policy_repositories
THE exactly-one-of resolver for a policy’s repository target(s).
repository_refs
Tolerant iterator over every repository ref a policy names — whatever exists, in repository-then-repositories order, no validity judgment. For any-of predicates (watch mappers, repo-edit guards, tenancy loops) that must not error on a malformed stored CR.
select_restore_repository
The repository a fromPolicy restore reads, resolved from the policy’s repository set + the restore’s optional explicit spec.repository. Pure — the resolver backstop shared with the M9 webhook mirror, so the two can never disagree.
single_repository_ref
The single repository a policy targets, for code paths that genuinely cannot take a multi-repository policy.
source_mutates_live_volume
Whether this source’s mount lets the kubelet rewrite the live workload volume: a writable mount with no staging in front of it.
source_read_only
Whether a source is mounted read-only. THE resolver for Source::read_only’s absent case, so the CRD’s advertised default: true and the mount agree by construction rather than by coincidence.