k3s-io / k3s

Lightweight Kubernetes
https://k3s.io
Apache License 2.0
28.13k stars 2.35k forks source link

Fix issue with loadbalancer failover to default server #11319

Closed brandond closed 1 week ago

brandond commented 1 week ago

Proposed Changes

The loadbalancer should only fail over to the default server if all other server have failed, and it should force fail-back to a preferred server as soon as one passes health checks.

The loadbalancer tests have been improved to ensure that this occurs.

Types of Changes

bugfix

Verification

See linked issue

Testing

yes

Linked Issues

User-Facing Change

Further Comments

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 73.91304% with 6 lines in your changes missing coverage. Please review.

Project coverage is 13.82%. Comparing base (71fdc4a) to head (3fb8207). Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/agent/loadbalancer/servers.go 78.94% 4 Missing :warning:
pkg/util/apierrors.go 0.00% 2 Missing :warning:

:exclamation: There is a different number of reports uploaded between BASE (71fdc4a) and HEAD (3fb8207). Click for more details.

HEAD has 18 uploads less than BASE | Flag | BASE (71fdc4a) | HEAD (3fb8207) | |------|------|------| |inttests|11|0| |e2etests|7|0|
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #11319 +/- ## =========================================== - Coverage 46.87% 13.82% -33.05% =========================================== Files 179 176 -3 Lines 18587 18526 -61 =========================================== - Hits 8712 2562 -6150 - Misses 8516 15665 +7149 + Partials 1359 299 -1060 ``` | [Flag](https://app.codecov.io/gh/k3s-io/k3s/pull/11319/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | Coverage Δ | | |---|---|---| | [e2etests](https://app.codecov.io/gh/k3s-io/k3s/pull/11319/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | `?` | | | [inttests](https://app.codecov.io/gh/k3s-io/k3s/pull/11319/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | `?` | | | [unittests](https://app.codecov.io/gh/k3s-io/k3s/pull/11319/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | `13.82% <73.91%> (+0.17%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.