Something went wrong. Try again.
A Forgejo Runner plugin that spawn jobs as Kubernetes pods
kubernetes ci forgejo runner
Something went wrong. Try again.
123456789101112131415161718192021use kube::Error as KubeError;use tonic::Status;
pub fn kube_status(action: &str, error: KubeError) -> Status { match error { KubeError::Api(response) if response.code == 404 => { Status::not_found(format!("{action}: {}", response.message)) } KubeError::Api(response) if response.code == 401 || response.code == 403 => { Status::permission_denied(format!("{action}: {}", response.message)) } KubeError::Api(response) if response.code == 409 => { Status::already_exists(format!("{action}: {}", response.message)) } KubeError::Api(response) if response.code == 429 || response.code >= 500 => { Status::unavailable(format!("{action}: {}", response.message)) } _ => Status::internal(format!("{action}: {error}")), }}