Expand description
The Maintenance CRD — schedules kopia maintenance run quick + full and
manages the ownership lease. At most one per repository. ADR-0001 §3.7.
Structs§
- Maintenance
- Auto-generated derived type for MaintenanceSpec via
CustomResource - Maintenance
Schedule - quick (cheap) and full (
--full, reclamation) maintenance crons and a shared timezone. - Maintenance
Spec - Maintenance schedule and ownership lease for one
Repository/ClusterRepository. - Maintenance
Status - Observed maintenance state: lease holder and per-kind run results.
- Manual
RunStatus - Bookkeeping for the most recent annotation-requested run.
- Ownership
- Maintenance ownership lease holder and takeover policy.
- Ownership
Status - Observed ownership-lease state: who holds it and since when.
- Repository
Maintenance Spec - Inline maintenance control on a
Repository/ClusterRepository(spec.maintenance). - RunStatus
- Per-kind (quick/full) run status.
Enums§
- Lease
Action - What to do about the ownership lease, decided from the takeover policy and
whether another owner currently holds it (ADR §3.7). Exhaustive over
TakeoverPolicy. - Manual
RunMode - Which maintenance kind a manual (annotation-requested) run performs; the wire
values are the
run-modeannotation values. Defaults toquick. - Manual
RunPhase - Lifecycle of a manual run. Closed enum.
- Takeover
Policy - What to do when another owner already holds the lease. Defaults to
Never(the safest: never seize a lease another owner holds).
Constants§
- LEASE_
HELD_ BY_ OTHER_ REASON LeaseOwned=Falsereason: a foreign owner holds the lease andtakeoverPolicy: Never— the run yielded.- LEASE_
OWNED_ CONDITION - The mover-owned condition recording lease state on
Maintenance.status:True(lease claimed, run proceeded) orFalsewith one of the reasons below. Written by the mover, matched by the controller (Ready degradation) and the kubectl plugin — one definition so the producers and readers cannot drift. - LEASE_
TAKEOVER_ PROMPT_ REASON LeaseOwned=Falsereason: a foreign owner holds the lease andtakeoverPolicy: PromptCondition— the run yielded, prompting the operator to setForce.
Functions§
- default_
maintenance_ schedule - The schedule an operator-managed
Maintenanceuses when the owningRepository/ClusterRepositorydoes not override it: quick every 6h (30m jitter), full daily at 03:00 (1h jitter). Shared by the webhook (defaulting), the controller (projection), and tests, so the default lives in exactly one place. ADR §3.7. - kopia_
lease_ identity - The STABLE kopia client identity a maintenance mover assumes for
lease((username, hostname)); the mover sets it withkopia repository set-clientso kopia’s designated-owner check compares something stable — the pod’s own identity is ephemeral (a new hostname every run), which is why comparing kopia’s recorded owner against it can never work. - kopia_
owner_ for_ lease - The full
user@hostnameowner string kopia records forlease— what the mover comparesmaintenance info’s owner against, and what the bootstrap stamps on a repository it CREATES. - lease_
action - Decide the lease action.
held_by_otheris true when a different owner currently holds the maintenance lease for this repository. - lease_
held_ by_ other - Whether kopia’s currently-recorded maintenance owner is a DIFFERENT owner
than us — i.e. neither our own lease’s owner nor one of our recognized
Ownership::owner_aliases(the migration path: a repo whose managedMaintenancemoved to a new lease format still recognizes the owner it used to stamp as itself, so the transition claims and re-stamps rather than yielding to what would otherwise look like a foreign owner). - managed_
lease - The logical maintenance-lease string the operator uses for a repository’s
DEFAULT-MANAGED
Maintenance(ADR §3.7). Single derivation, shared by the managed-Maintenance projection and the bootstrap mover’s initial kopia owner stamp, so they cannot drift. - parse_
run_ annotations - Parse the
run-requested/run-modeannotations into a manual-run request.Ok(None)= no request;Err= the annotations are present but malformed (the messages say how to fix). Shared by the admission webhook and the controller so validation cannot fork (SKILL “one validator, two callers”).