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

fix: when give ipv4 cidr ipv6 gateway, the gateway will extend infini… #3860

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

changluyi
Copy link
Collaborator

@changluyi changluyi commented Mar 22, 2024

…tely

Pull Request

What type of this PR

repeat steps:

  1. create ipv4 subnet
  2. edit the gateway with a dual gateway, like "10.16.0.1,ff01::1"
  3. the gateway string will extend infinity like this

image

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes

Fixes #(issue-number)

…tely

Signed-off-by: Changlu Yi <clyi@alauda.io>
@@ -428,7 +428,7 @@ func checkAndUpdateGateway(subnet *kubeovnv1.Subnet) (bool, error) {
switch {
case subnet.Spec.Gateway == "":
gw, err = util.GetGwByCidr(subnet.Spec.CIDRBlock)
case util.CheckProtocol(subnet.Spec.Gateway) != util.CheckProtocol(subnet.Spec.CIDRBlock):
case subnet.Spec.Protocol == kubeovnv1.ProtocolDual && util.CheckProtocol(subnet.Spec.Gateway) != util.CheckProtocol(subnet.Spec.CIDRBlock):
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里用到了subnet.Spec.Protocol 的取值,所以 formatSubnet 中 subnet.Spec.Protocol 的检查和赋值,最好放在 checkSubnetChanged 之前,保证这里使用的时候,是正确的 protocol 取值

@changluyi changluyi merged commit 55c314e into release-1.12 Mar 25, 2024
55 of 57 checks passed
@changluyi changluyi deleted the fix_gateway_extend_1.12 branch March 25, 2024 01:26
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