Merge labels from the sandbox template with required managed labels. User-supplied labels are inserted first so that the managed labels always win -- preventing template overrides of internal tracking labels.
(sandbox: &DriverSandbox)
| 431 | /// User-supplied labels are inserted first so that the managed labels |
| 432 | /// always win -- preventing template overrides of internal tracking labels. |
| 433 | fn build_labels(sandbox: &DriverSandbox) -> BTreeMap<String, String> { |
| 434 | let template = sandbox.spec.as_ref().and_then(|s| s.template.as_ref()); |
| 435 | |
| 436 | let mut labels: BTreeMap<String, String> = BTreeMap::new(); |
| 437 | if let Some(t) = template { |
| 438 | for (k, v) in &t.labels { |
| 439 | labels.insert(k.clone(), v.clone()); |
| 440 | } |
| 441 | } |
| 442 | // Managed labels (highest priority -- always overwrite). |
| 443 | labels.insert(LABEL_SANDBOX_ID.into(), sandbox.id.clone()); |
| 444 | labels.insert(LABEL_SANDBOX_NAME.into(), sandbox.name.clone()); |
| 445 | labels.insert(LABEL_SANDBOX_NAMESPACE.into(), sandbox.namespace.clone()); |
| 446 | labels.insert(LABEL_MANAGED.into(), "true".into()); |
| 447 | |
| 448 | labels |
| 449 | } |
| 450 | |
| 451 | /// Parse resource limits from the sandbox template, falling back to defaults. |
| 452 | fn build_resource_limits(sandbox: &DriverSandbox, config: &PodmanComputeConfig) -> ResourceLimits { |
no outgoing calls
no test coverage detected