openyurtio / openyurt

OpenYurt - Extending your native Kubernetes to edge(project under CNCF)
https://openyurt.io
Apache License 2.0
1.68k stars 391 forks source link

feat: support viploadbalancer controller #2036

Open wangxye opened 2 months ago

wangxye commented 2 months ago

What type of PR is this?

/kind feature

What this PR does / why we need it:

As the second-level controller for the multi-region load balancer, It is used to support the control of high availability of virtual IP based edge services, monitor poolservice changes, and is used to synchronize vrid changes to the vip agent at the edge.

Special notes for your reviewer:

/assign @rambohe-ch @zyjhtangtang @River-sh @Rui-Gan

Does this PR introduce a user-facing change?

Support left-closed-right-open ip assignment:

# if you use vip for load-balancer, you should annotate the vip address for the nodepool.
kubectl annotate nodepool hangzhou openyurt.io/address-pools="192.168.0.1-192.168.1.0, 10.0.1.0"

# For vip-type load balance, if you want to specify a vip for a service, you needs to annotate the specified address.
kubectl annotate service nginx service.openyurt.io/vip="192.168.0.1-168.0.3, 10.0.1.0"
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 66.58879% with 143 lines in your changes missing coverage. Please review.

Project coverage is 56.27%. Comparing base (2154da8) to head (aae406d). Report is 14 commits behind head on master.

Files Patch % Lines
...rset/viploadbalancer/viploadbalancer_controller.go 57.97% 74 Missing and 34 partials :warning:
...ebhook/poolservice/v1alpha1/poolservice_handler.go 0.00% 11 Missing :warning:
...oller/loadbalancerset/viploadbalancer/predicate.go 70.58% 5 Missing and 5 partials :warning:
...roller/loadbalancerset/viploadbalancer/ip_utils.go 92.66% 4 Missing and 4 partials :warning:
...ebhook/poolservice/v1alpha1/poolservice_default.go 64.70% 3 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2036 +/- ## ========================================== + Coverage 55.62% 56.27% +0.65% ========================================== Files 186 191 +5 Lines 18072 18519 +447 ========================================== + Hits 10052 10422 +370 - Misses 6995 7018 +23 - Partials 1025 1079 +54 ``` | [Flag](https://app.codecov.io/gh/openyurtio/openyurt/pull/2036/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openyurtio) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/openyurtio/openyurt/pull/2036/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openyurtio) | `56.27% <66.58%> (+0.65%)` | :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=openyurtio#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.

wangxye commented 2 months ago

/hold

wangxye commented 2 months ago

/rerun

wangxye commented 2 months ago

/unhold

wangxye commented 2 months ago

/assign @rambohe-ch @zyjhtangtang @River-sh @Rui-Gan

wangxye commented 2 months ago

I have updated the logic of syncPoolService to first synchronize the validly allocated vrids in the cluster first, which is used to support the user-specified mode of vrid deployment. In addition, we will perform unified allocation for unallocated or vrid exceptions, which include cases where the annotation of the vrid is null, the vrid is abnormal, and the vrid is out of range. This layer of logic will also be judged in reconcileDelete.

sonarcloud[bot] commented 4 weeks ago

Quality Gate Passed Quality Gate passed

Issues
8 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.5% Duplication on New Code

See analysis details on SonarCloud