Skip to content

Commit

Permalink
fix: ignore connection reset errors on k8s upgrade
Browse files Browse the repository at this point in the history
This fixes `talosctl upgrade-k8s`:

```
Get "https://172.21.0.1:6443/api/v1/namespaces/kube-system/pods?labelSelector=k8s-app+%3D+kube-apiserver": read tcp 172.21.0.1:51416->172.21.0.1:6443: read: connection reset by peer
```

The error happens when the `kube-apiserver` is restarted during the
control plane upgrade, and it should be ignored as a transient error.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Mar 18, 2022
1 parent c156580 commit 5e0c80f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/kubernetes/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ func IsRetryableError(err error) bool {
return true
}

if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.ECONNREFUSED) {
return true
for _, retryableError := range []error{io.EOF, io.ErrUnexpectedEOF, syscall.ECONNREFUSED, syscall.ECONNRESET} {
if errors.Is(err, retryableError) {
return true
}
}

var netErr net.Error
Expand Down

0 comments on commit 5e0c80f

Please sign in to comment.