Skip to content

Commit fcdb7ac

Browse files
committed
Filter for specific error message
1 parent b79e8db commit fcdb7ac

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

  • rust/operator-binary/src/restart_controller

rust/operator-binary/src/restart_controller/pod.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,27 @@ async fn report_result(
215215
)) = &result
216216
{
217217
const TOO_MANY_REQUESTS_HTTP_CODE: u16 = StatusCode::TOO_MANY_REQUESTS.as_u16();
218+
// We can not blanket silence all 429 responses, as it could be something else.
219+
// E.g. I have seen "storage is re-initializing" in the past.
220+
const EVICT_ERROR_MESSAGE: &str =
221+
"Cannot evict pod as it would violate the pod's disruption budget.";
222+
218223
if let kube::Error::Api(ErrorResponse {
219224
code: TOO_MANY_REQUESTS_HTTP_CODE,
225+
message: error_message,
220226
..
221227
}) = evict_pod_error
228+
// TODO: We need Rust 1.88 and 2024 edition for if-let-chains
229+
// && error_message == EVICT_ERROR_MESSAGE
222230
{
223-
tracing::info!(
224-
%pod,
225-
error = %evict_pod_error,
226-
"Tried to evict Pod, but wasn't allowed to do so, as it would violate the Pod's disruption budget. Retrying later"
227-
);
228-
return;
231+
if error_message == EVICT_ERROR_MESSAGE {
232+
tracing::info!(
233+
%pod,
234+
error = %evict_pod_error,
235+
"Tried to evict Pod, but wasn't allowed to do so, as it would violate the Pod's disruption budget. Retrying later"
236+
);
237+
return;
238+
}
229239
}
230240
}
231241

0 commit comments

Comments
 (0)