mirror of https://github.com/k3s-io/k3s
Merge pull request #75167 from tnozicka/fix-retry-watcher-error
Handle unstructured status in RetryWatcherpull/564/head
commit
44e369b000
|
@ -184,13 +184,17 @@ func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
|
|||
continue
|
||||
|
||||
case watch.Error:
|
||||
status, ok := event.Object.(*metav1.Status)
|
||||
// This round trip allows us to handle unstructured status
|
||||
errObject := apierrors.FromObject(event.Object)
|
||||
statusErr, ok := errObject.(*apierrors.StatusError)
|
||||
if !ok {
|
||||
klog.Error(spew.Sprintf("Received an error which is not *metav1.Status but %#+v", event.Object))
|
||||
// Retry unknown errors
|
||||
return false, 0
|
||||
}
|
||||
|
||||
status := statusErr.ErrStatus
|
||||
|
||||
statusDelay := time.Duration(0)
|
||||
if status.Details != nil {
|
||||
statusDelay = time.Duration(status.Details.RetryAfterSeconds) * time.Second
|
||||
|
|
Loading…
Reference in New Issue