Skip to main content

Module snapshot_replication

Module snapshot_replication 

Source
Expand description

The SnapshotReplication CRD — copy snapshot manifests (and the content they reference) from one repository to another on a schedule, wrapping kopia snapshot migrate (issue #368).

Where RepositoryReplication mirrors a repository’s blobs verbatim (kopia repository sync-to — same format, same password, all-or-nothing), SnapshotReplication copies at the snapshot level: source and destination are BOTH real repository CRs with their own passwords/formats, and a selector chooses which kopia identities (and optionally only their latest snapshots) get copied. It is namespaced (it lives alongside its source, like Maintenance and RepositoryReplication) and references its repositories via RepositoryRef — a cluster-scoped ClusterRepository destination is the flagship consolidation use case.

Each copied snapshot is materialized as a Snapshot CR (origin: replicated) in this CR’s namespace by the replication mover, with no ownerReference back to this CR: deleting the SnapshotReplication never deletes the copies. Only spec.pruning (or deleting the copy Snapshot CRs themselves) removes replicated data.

Structs§

IdentityMatcher
One glob match against a kopia identity’s structured (username, hostname, sourcePath) triple. Every set component must match (AND); an unset component matches anything — but at least one component must be set (webhook-refused otherwise: a fully-empty matcher constrains nothing).
IdentitySelection
Include/exclude lists of identity matchers. An identity is selected when it matches at least one include entry (an empty/absent include list means “everything”) AND matches no exclude entry — exclude always wins.
MigrateOptions
Tuning for kopia snapshot migrate. Pure scalars + an optional throttle sub-object, so Eq but NOT Copy (Throttle isn’t).
MirrorSourcePruning
Marker for Pruning::MirrorSource — no fields today (sub-object for forward-compat, ADR §4.11).
NoPruning
Marker for Pruning::None — no fields today; a sub-object so future knobs slot in without API breakage (ADR §4.11).
SelectionSpec
Which snapshots a replication copies. Pure scalars, so Eq (unlike the parent spec).
SnapshotReplication
Auto-generated derived type for SnapshotReplicationSpec via CustomResource
SnapshotReplicationRunStats
Counters from the most recent replication run, written by the mover’s terminal status patch. Pure scalars, so Eq.
SnapshotReplicationSpec
Copy selected snapshots from a source repository into a destination repository on a schedule (kopia snapshot migrate).
SnapshotReplicationStatus
Observed state of a SnapshotReplication.

Enums§

PolicyCopyMode
How kopia snapshot migrate treats the source’s kopia policies.
Pruning
Exactly one pruning mode for already-replicated copies (externally tagged: pruning: { retention: {...} }). Absent spec.pruning = Pruning::None.
SnapshotReplicationPhase
Lifecycle phase of a snapshot replication.

Functions§

component_glob_matches
Anchored per-component glob match: * matches any run of characters (including none), ? matches exactly one, everything else is literal. This is the ONE matcher both admission (via validate_component_glob) and the replication mover use, so what the webhook admitted and what the mover selects cannot fork. Deliberately dependency-free — no regex, no glob crate.
validate_component_glob
Admission-time check that an IdentityMatcher component pattern is one component_glob_matches can honor: non-empty, no control characters, and none of the glob syntax this matcher deliberately does NOT support ([...] character classes, {...} brace expansion). Rejecting those up front beats silently matching them as literal characters — a data[0-9] that never matches anything is the silent-no-op failure mode this repo designs out.