Skip to main content

Module seed

Module seed 

Source
Expand description

spec.seed — initialize a brand-new repository from an existing replica (issue #380).

Disaster recovery starts with an empty cluster and a full off-site mirror. Without this block the only way to get the mirror’s history back under kopiur’s management is to point a Repository at the mirror itself (which then becomes the live repository the new cluster writes into) or to copy the blobs by hand. spec.seed makes the first bootstrap of an uninitialized backend pull the data across first, in one mover Job, before the repository is ever reported Ready.

Two source shapes, one field:

  • SeedSource::Backendblob mode: a bare storage backend holding a byte-for-byte mirror of a kopia repository (what a RepositoryReplication writes). The copy is kopia repository sync-to, so the new repository inherits the mirror’s format and password verbatim — this repository’s own encryption.passwordSecretRef must therefore already carry the mirror’s password.
  • SeedSource::Repositorymigrate mode: another Repository or ClusterRepository CR, opened read-only. The copy is kopia snapshot migrate, which preserves each snapshot’s username@hostname:path identity and times, so seeded history stays restorable by identity/fromPolicy. Source and destination are two real repositories with their own passwords and formats.

Not to be confused with the “seed job” fixtures in deploy/examples — those are one-shot Jobs that write test data into a volume. This block seeds a repository, from another repository.

Seeding is armed only while the repository has never been initialized (status.uniqueId unset) AND the mover’s first connect reports the backend uninitialized. On an already-initialized repository the block is a documented no-op (Seeded=True, reason AlreadyInitialized), so it is safe to leave standing in a GitOps manifest forever.

Structs§

SeedMigrateOptions
Migrate-mode tuning for kopia snapshot migrate.
SeedSpec
Initialize this repository from an existing replica on its first bootstrap.
SeedStatus
What the last seed attempt did, pinned on Repository/ClusterRepository status.seed. Absent on a repository that was never seeded.
SeedSyncOptions
Blob-mode tuning for kopia repository sync-to.

Enums§

SeedMode
Which copy mechanism a seed ran. Mirrors the SeedSource variant, named after the operation rather than the input so status, metrics (kopiur_repository_seed_total{mode}) and docs share one vocabulary.
SeedSource
Where a seed reads from — exactly one of, externally tagged (from: { backend: { s3: {...} } } or from: { repository: {...} }).

Constants§

DEFAULT_SEED_BOOTSTRAP_DEADLINE_SECS
Default activeDeadlineSeconds for a bootstrap Job that is seeding — 24 hours, versus the 120s a routine connect gets.

Functions§

seed_active_deadline_seconds
The activeDeadlineSeconds a seeding bootstrap Job gets: the repository’s own spec.seed.failurePolicy.activeDeadlineSeconds, else DEFAULT_SEED_BOOTSTRAP_DEADLINE_SECS.
seed_armed
Whether a repository whose status.uniqueId is unique_id should arm its seed (D4): a seed runs only on a repository that has never been initialized. Once the bootstrap pins a unique ID the block is a standing no-op.
seed_backend
The Backend a blob-mode seed reads from, or None for migrate mode. Exhaustive counterpart to seed_repository_ref.
seed_repository_ref
The RepositoryRef a migrate-mode seed reads from, or None for blob mode. Exhaustive helper so callers that only care about the CR-reference case (referent watches, tenancy gates, credential resolution) do not each write their own match.
seed_resume
Whether an armed seed must RESUME an attempt a previous bootstrap started but did not finish, rather than run as a first seed.