Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support viploadbalancer controller #2036

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

wangxye
Copy link
Member

@wangxye wangxye commented Apr 27, 2024

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"

Copy link

codecov bot commented Apr 27, 2024

Codecov Report

Attention: Patch coverage is 66.75824% with 121 lines in your changes are missing coverage. Please review.

Project coverage is 55.84%. Comparing base (2154da8) to head (38eba42).

Files Patch % Lines
...rset/viploadbalancer/viploadbalancer_controller.go 55.50% 62 Missing and 27 partials ⚠️
...tmanager/webhook/service/corev1/service_handler.go 0.00% 11 Missing ⚠️
...oller/loadbalancerset/viploadbalancer/predicate.go 70.58% 5 Missing and 5 partials ⚠️
...roller/loadbalancerset/viploadbalancer/ip_utils.go 91.66% 5 Missing and 4 partials ⚠️
...tmanager/webhook/service/corev1/service_default.go 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2036      +/-   ##
==========================================
+ Coverage   55.62%   55.84%   +0.21%     
==========================================
  Files         186      191       +5     
  Lines       18072    18436     +364     
==========================================
+ Hits        10052    10295     +243     
- Misses       6995     7079      +84     
- Partials     1025     1062      +37     
Flag Coverage Δ
unittests 55.84% <66.75%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wangxye wangxye force-pushed the feat/vip_lb_controller branch 2 times, most recently from 75e4110 to 77148c3 Compare April 27, 2024 15:24
@wangxye
Copy link
Member Author

wangxye commented Apr 27, 2024

/hold

@wangxye wangxye force-pushed the feat/vip_lb_controller branch 4 times, most recently from f156534 to 963c247 Compare May 4, 2024 08:39
@wangxye
Copy link
Member Author

wangxye commented May 4, 2024

/rerun

@wangxye
Copy link
Member Author

wangxye commented May 4, 2024

/unhold

@wangxye
Copy link
Member Author

wangxye commented May 4, 2024

)

// Default satisfies the defaulting webhook interface.
func (webhook *PoolServiceHandler) Default(ctx context.Context, obj runtime.Object) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that may be we need to add a Service Webhook, and add service topology annotation on Service instead of PoolService.

@wangxye
Copy link
Member Author

wangxye commented May 9, 2024

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.

@wangxye wangxye force-pushed the feat/vip_lb_controller branch 2 times, most recently from 5a22c72 to 9fbfb43 Compare May 16, 2024 07:13
Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
…offline status

Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Comment on lines 14 to 25
/*
Copyright 2024 The OpenYurt Authors.
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license comment is duplicated.

…vip-loadbalance

Signed-off-by: wangxye <xuanyewang.cs@gmail.com>
Copy link

sonarcloud bot commented May 21, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

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

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants