(&self)
| 406 | } |
| 407 | |
| 408 | async fn has_gpu_capacity(&self) -> Result<bool, KubeError> { |
| 409 | let nodes: Api<Node> = Api::all(self.client.clone()); |
| 410 | let node_list = nodes.list(&ListParams::default()).await?; |
| 411 | Ok(node_list.items.into_iter().any(|node| { |
| 412 | node.status |
| 413 | .and_then(|status| status.allocatable) |
| 414 | .and_then(|allocatable| allocatable.get(GPU_RESOURCE_NAME).cloned()) |
| 415 | .is_some_and(|quantity| quantity.0 != "0") |
| 416 | })) |
| 417 | } |
| 418 | |
| 419 | pub async fn validate_sandbox_create(&self, sandbox: &Sandbox) -> Result<(), tonic::Status> { |
| 420 | let _ = KubernetesSandboxDriverConfig::from_sandbox(sandbox) |
no test coverage detected