| 390 | |
| 391 | #[allow(clippy::result_large_err)] |
| 392 | fn pod_sandbox_id(pod: &Pod) -> Result<String, Status> { |
| 393 | let sandbox_id = pod |
| 394 | .metadata |
| 395 | .annotations |
| 396 | .as_ref() |
| 397 | .and_then(|a| a.get(SANDBOX_ID_ANNOTATION)) |
| 398 | .cloned() |
| 399 | .unwrap_or_default(); |
| 400 | if sandbox_id.is_empty() { |
| 401 | return Err(Status::permission_denied( |
| 402 | "pod is not bound to a sandbox identity", |
| 403 | )); |
| 404 | } |
| 405 | Ok(sandbox_id) |
| 406 | } |
| 407 | |
| 408 | #[allow(clippy::result_large_err)] |
| 409 | fn sandbox_owner_reference(pod: &Pod) -> Result<SandboxOwnerReference, Status> { |