Expand description
Pure, controller-free reasoning about whether a mover’s resolved security context can read a backup source PVC, and the inverse — whether a future workload can read what a restore mover writes to a target PVC.
§Why this is deliberately conservative
A predicate that reasons only from security contexts cannot see file mode bits,
and world-readable 0644 data is everywhere. So it can almost never be certain a
backup will fail — the only honest verdicts from the spec alone are:
Compatible— provably fine: the mover is root, or its UID exactly matches every writer’s UID. (We never claimCompatibleon a group/fsGroupbasis — see below.)Unknown— we cannot tell from the spec (the common case). The mover-side readability preflight (incrates/mover) is the layer that certainly validates this at runtime, where the files are actually mounted.LikelyIncompatible— reserved for near-certainty (the mover shares neither UID nor any group with the writers). Used only for a best-effort, advisory admission warning; the reconcile loop maps it to a non-blockingUnknowncondition (the certainFalsecomes from the mover preflight), so a0644tree never produces a false alarm on a successful backup.
§fsGroup is excluded from backup-source reasoning
A backup mounts the source PVC read-only by default, so the kubelet never recursively
chgrp’s it and fsGroup grants nothing for readability there. We therefore never treat an
fsGroup match as a path to Compatible for backups. (fsGroup is only counted toward
the mover’s process group set, which can only ever soften a mismatch to Unknown —
the safe direction.) On restore the target is a fresh read-write volume where the
kubelet does apply fsGroup, so assess_restore_compat treats an fsGroup match as
a positive signal — the predicates are intentionally asymmetric.
Source::readOnly: false (#254) exists precisely to re-enable that walk on the source, so
it partially unwinds this: with a writable source and an fsGroup, the kubelet MAY chgrp
the tree to the mover’s own group, which would make the source readable no matter who wrote
it. That is not enough for Compatible — whether the walk happens depends on the
CSIDriver’s fsGroupPolicy and on fsGroupChangePolicy, neither of which is in the spec —
but it IS enough to invalidate every workload-ownership comparison. So
assess_read_compat takes the effective readOnly and short-circuits to
Unknown { FsGroupMayApply }. Without that, the one configuration the flag exists to
enable would be reported LikelyIncompatible while working fine.
Structs§
- Mover
Identity - The mover’s effective identity for read reasoning (backup source), built from the resolved, post-invariant container + pod security contexts.
- Mover
Write Identity - The mover’s effective identity for write reasoning (restore target).
- Workload
Identity - A workload pod’s identity, for comparing against a mover. One per consuming pod.
Enums§
- Compat
Basis - Basis on which a backup mover was found read-compatible. Exhaustive (thesis §5.5).
- Mover
Read Compat - Whether a backup mover can read the source PVC’s files. See the module docs for why
Compatibleis rare andLikelyIncompatiblerarer still. - Restore
Basis - Basis on which a restore was found write-compatible with the future consumer.
- Restore
Unknown - Why a restore write-compatibility verdict is undecidable from the spec alone.
- Restore
Write Compat - Whether a future workload can read what a restore mover writes. The restore counterpart
of
MoverReadCompat—fsGroupIS load-bearing here (fresh read-write volume). - Unknown
Reason - Why a backup read-compatibility verdict is undecidable from the spec alone.
Functions§
- assess_
read_ compat - Assess whether a backup mover can read the source PVC’s files, given the workload pods
mounting it. See the module docs for the conservative posture; the result is deterministic
(independent of
workloadsordering). - assess_
restore_ compat - Assess whether the future consumer of a restore target can read what the mover writes.
fsGroupIS a positive signal here (fresh read-write volume).futureisNonewhen no pod consumes the target yet (the common case →ConsumerAbsent). - container_
mounting_ claim - The container within
podthat mountsclaim_name: resolve the pod volume(s) backed by the claim, then find the container whosevolumeMountsreference one. - is_
managed_ by_ kopiur - Whether a pod is a kopiur-managed object (carries
app.kubernetes.io/managed-by=kopiur). A mover Job’s pod mounts the source PVC too, so consumer-discovery and compatibility reasoning must exclude these — otherwise the mover would be compared against (or inherit from) itself. The single definition, shared by the controller and webhook. - mover_
identity - Build the mover’s read identity from its resolved container + pod security contexts.
- mover_
write_ identity - Build the mover’s write identity (restore) from its resolved contexts.
- pod_
mounts_ claim - Does this pod mount
claim_namevia apersistentVolumeClaimvolume? The canonical scanner — the controller’s colocation logic reuses this so the two never drift. - pods_
mounting_ pvc - Pods (in stable input order) that mount
claim_name. - workload_
identities - Build
WorkloadIdentityfor every workload pod mountingclaim_name— i.e. those mounting the claim, minus kopiur-managed (mover) pods. The shared core for backup, restore, and webhook compatibility checks (one definition, no per-caller duplication). - workload_
identity - Extract a
WorkloadIdentityfrom a live pod: the union of init + main container effective UIDs (pod fallback) as writers, and the file-group candidates.