Skip to main content

populate_job_name

Function populate_job_name 

Source
pub fn populate_job_name(restore: &str, consumer_uid: &str) -> String
Expand description

The deterministic name of the populate mover Job for one claiming PVC.

<restore>-populate-<h8>, capped at [MAX_CHILD_NAME] (63) — a Job name becomes a batch.kubernetes.io/job-name label value, which Kubernetes caps at 63 bytes.

<h8> is 8 hex of FNV-1a over the claiming PVC’s metadata.uid and is never clipped: it is what makes N claimants of one Restore produce N distinct Jobs, and what makes a DELETED-and-re-created claim (a new uid) get a fresh Job instead of adopting the dead claim’s. The pre-#443 name was the bare <restore>-populate, which is why only one claimant could ever be populated; that legacy name is still driven for an adopted in-flight claim (see the controller’s JobNameReuse), never minted anew.

let n = populate_job_name("restore-pg", "9f1c-uid");
assert!(n.starts_with("restore-pg-populate-"));
assert!(n.len() <= 63);
// Distinct claimants never collide.
assert_ne!(n, populate_job_name("restore-pg", "other-uid"));