Skip to content

Commit

Permalink
Merge pull request #2773 from ty-dc/e2e/fix-cidr
Browse files Browse the repository at this point in the history
e2e-fix: Avoid random subnets from overlapping with the subnets of clusters calico and cilium
  • Loading branch information
weizhoublue authored Dec 8, 2023
2 parents 22d10d4 + c5ae3b9 commit fbdc5a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/e2e/common/spiderpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ func GenerateExampleIpv4poolObject(ipNum int) (string, *v1.SpiderIPPool) {
},
}
if ipNum <= 253 {
iPv4PoolObj.Spec.Subnet = fmt.Sprintf("10.%s.%s.0/24", randomNumber1, randomNumber2)
iPv4PoolObj.Spec.Subnet = fmt.Sprintf("192.%s.%s.0/24", randomNumber1, randomNumber2)
} else {
iPv4PoolObj.Spec.Subnet = fmt.Sprintf("10.%s.0.0/16", randomNumber1)
iPv4PoolObj.Spec.Subnet = fmt.Sprintf("192.%s.0.0/16", randomNumber1)
}
ips, err := GenerateIPs(iPv4PoolObj.Spec.Subnet, ipNum+1)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -443,9 +443,9 @@ func GenerateExampleIpv6poolObject(ipNum int) (string, *v1.SpiderIPPool) {
}

if ipNum <= 253 {
iPv6PoolObj.Spec.Subnet = fmt.Sprintf("fd00:%s::/120", randomNumber)
iPv6PoolObj.Spec.Subnet = fmt.Sprintf("fd00:192:%s::/120", randomNumber)
} else {
iPv6PoolObj.Spec.Subnet = fmt.Sprintf("fd00:%s::/112", randomNumber)
iPv6PoolObj.Spec.Subnet = fmt.Sprintf("fd00:192:%s::/112", randomNumber)
}

ips, err := GenerateIPs(iPv6PoolObj.Spec.Subnet, ipNum+1)
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/common/spidersubnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func GenerateExampleV4SubnetObject(f *frame.Framework, ipNum int) (string, *spid
randNum1 := GenerateRandomNumber(255)
randNum2 := GenerateRandomNumber(255)
if ipNum <= 253 {
newSubnetObj.Spec.Subnet = fmt.Sprintf("10.%s.%s.0/24", randNum1, randNum2)
newSubnetObj.Spec.Subnet = fmt.Sprintf("192.%s.%s.0/24", randNum1, randNum2)
} else {
newSubnetObj.Spec.Subnet = fmt.Sprintf("10.%s.0.0/16", randNum1)
newSubnetObj.Spec.Subnet = fmt.Sprintf("192.%s.0.0/16", randNum1)
}
oldSubnets, _ := GetAllSubnet(f)
for _, oldSubnet := range oldSubnets.Items {
Expand Down Expand Up @@ -94,9 +94,9 @@ func GenerateExampleV6SubnetObject(f *frame.Framework, ipNum int) (string, *spid
for i := 0; i < 5; i++ {
randNum := GenerateString(4, true)
if ipNum <= 253 {
newSubnetObj.Spec.Subnet = fmt.Sprintf("fd00:%s::/120", randNum)
newSubnetObj.Spec.Subnet = fmt.Sprintf("fd00:192:%s::/120", randNum)
} else {
newSubnetObj.Spec.Subnet = fmt.Sprintf("fd00:%s::/112", randNum)
newSubnetObj.Spec.Subnet = fmt.Sprintf("fd00:192:%s::/112", randNum)
}
oldSubnets, _ := GetAllSubnet(f)
for _, oldSubnet := range oldSubnets.Items {
Expand Down

0 comments on commit fbdc5a3

Please sign in to comment.