mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
Provide a better error when Kubelet pod status is unexpected
Treat HTTP errors with respect, provide a distinct error message
This commit is contained in:
@@ -135,6 +135,9 @@ func (c *HTTPKubeletClient) GetPodStatus(host, podNamespace, podID string) (api.
|
||||
if response.StatusCode == http.StatusNotFound {
|
||||
return status, ErrPodInfoNotAvailable
|
||||
}
|
||||
if response.StatusCode >= 300 || response.StatusCode < 200 {
|
||||
return status, fmt.Errorf("kubelet %q server responded with HTTP error code %d for pod %s/%s", host, response.StatusCode, podNamespace, podID)
|
||||
}
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return status, err
|
||||
|
Reference in New Issue
Block a user