Skip to content

Commit

Permalink
Test in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
zarvd committed Aug 30, 2024
1 parent d50207c commit 4845c29
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions tests/e2e/network/network_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,21 @@ var _ = Describe("Network security group", Label(utils.TestSuiteLabelNSG), func(
allowedIPv6Ranges = []string{
"2c0f:fe40:8000::/48", "2c0f:feb0::/43",
}

// The overlapping IP ranges will be aggregated after reconciled
overlappingIPv4Ranges = []string{
"10.20.8.0/24",
"10.20.9.0/25",
"10.20.8.1/32",
"192.168.0.1/32",
}
overlappingIPv6Ranges = []string{
"2c0f:fe40:8000::/49",
"2c0f:fe40:8000:1111::/64",
"2c0f:feb0::/43",
"2c0f:feb0::/44",
"2c0f:feb0::1/128",
}
)

By("Creating a LoadBalancer service", func() {
Expand All @@ -246,7 +261,13 @@ var _ = Describe("Network security group", Label(utils.TestSuiteLabelNSG), func(
"app": ServiceName,
}
annotations = map[string]string{
v1.AnnotationLoadBalancerSourceRangesKey: strings.Join(append(allowedIPv4Ranges, allowedIPv6Ranges...), ","),
v1.AnnotationLoadBalancerSourceRangesKey: strings.Join(
append(
append(allowedIPv4Ranges, overlappingIPv4Ranges...),
append(allowedIPv6Ranges, overlappingIPv6Ranges...)...,
),
",",
),
}
ports = []v1.ServicePort{{
Port: serverPort,
Expand Down Expand Up @@ -619,6 +640,21 @@ var _ = Describe("Network security group", Label(utils.TestSuiteLabelNSG), func(
allowedIPv6Ranges = []string{
"2c0f:fe40:8000::/48", "2c0f:feb0::/43",
}

// The overlapping IP ranges will be aggregated after reconciled
overlappingIPv4Ranges = []string{
"10.20.8.0/24",
"10.20.9.0/25",
"10.20.8.1/32",
"192.168.0.1/32",
}
overlappingIPv6Ranges = []string{
"2c0f:fe40:8000::/49",
"2c0f:fe40:8000:1111::/64",
"2c0f:feb0::/43",
"2c0f:feb0::/44",
"2c0f:feb0::1/128",
}
)

By("Creating a LoadBalancer service", func() {
Expand All @@ -627,7 +663,13 @@ var _ = Describe("Network security group", Label(utils.TestSuiteLabelNSG), func(
"app": ServiceName,
}
annotations = map[string]string{
consts.ServiceAnnotationAllowedIPRanges: strings.Join(append(allowedIPv4Ranges, allowedIPv6Ranges...), ","),
consts.ServiceAnnotationAllowedIPRanges: strings.Join(
append(
append(allowedIPv4Ranges, overlappingIPv4Ranges...),
append(allowedIPv6Ranges, overlappingIPv6Ranges...)...,
),
",",
),
}
ports = []v1.ServicePort{{
Port: serverPort,
Expand Down

0 comments on commit 4845c29

Please sign in to comment.