Skip to content

Commit 2402bfd

Browse files
authored
Merge pull request kubernetes#91997 from aramase/floating-ipv6
azure: enable floating IP for IPv6 LB
2 parents 27c7077 + 0ef792e commit 2402bfd

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,15 +1080,9 @@ func (az *Cloud) reconcileLoadBalancerRule(
10801080
BackendPort: to.Int32Ptr(port.Port),
10811081
DisableOutboundSnat: to.BoolPtr(az.disableLoadBalancerOutboundSNAT()),
10821082
EnableTCPReset: enableTCPReset,
1083+
EnableFloatingIP: to.BoolPtr(true),
10831084
},
10841085
}
1085-
// LB does not support floating IPs for IPV6 rules
1086-
if utilnet.IsIPv6String(service.Spec.ClusterIP) {
1087-
expectedRule.BackendPort = to.Int32Ptr(port.NodePort)
1088-
expectedRule.EnableFloatingIP = to.BoolPtr(false)
1089-
} else {
1090-
expectedRule.EnableFloatingIP = to.BoolPtr(true)
1091-
}
10921086

10931087
if protocol == v1.ProtocolTCP {
10941088
expectedRule.LoadBalancingRulePropertiesFormat.IdleTimeoutInMinutes = lbIdleTimeout
@@ -1158,8 +1152,6 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
11581152
}
11591153
expectedSecurityRules := []network.SecurityRule{}
11601154

1161-
ipv6 := utilnet.IsIPv6String(service.Spec.ClusterIP)
1162-
11631155
if wantLb {
11641156
expectedSecurityRules = make([]network.SecurityRule, len(ports)*len(sourceAddressPrefixes))
11651157

@@ -1171,7 +1163,7 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
11711163
for j := range sourceAddressPrefixes {
11721164
ix := i*len(sourceAddressPrefixes) + j
11731165
securityRuleName := az.getSecurityRuleName(service, port, sourceAddressPrefixes[j])
1174-
securityRule := network.SecurityRule{
1166+
expectedSecurityRules[ix] = network.SecurityRule{
11751167
Name: to.StringPtr(securityRuleName),
11761168
SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{
11771169
Protocol: *securityProto,
@@ -1183,13 +1175,6 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
11831175
Direction: network.SecurityRuleDirectionInbound,
11841176
},
11851177
}
1186-
// For IPv6, the destination port needs to be node port and Destination Any as floating IPs
1187-
// not supported for IPv6
1188-
if ipv6 {
1189-
securityRule.SecurityRulePropertiesFormat.DestinationPortRange = to.StringPtr(strconv.Itoa(int(port.NodePort)))
1190-
securityRule.SecurityRulePropertiesFormat.DestinationAddressPrefix = to.StringPtr("*")
1191-
}
1192-
expectedSecurityRules[ix] = securityRule
11931178
}
11941179
}
11951180
}

staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,9 +1879,9 @@ func TestReconcileSecurityGroup(t *testing.T) {
18791879
SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{
18801880
Protocol: network.SecurityRuleProtocol("Tcp"),
18811881
SourcePortRange: to.StringPtr("*"),
1882-
DestinationPortRange: to.StringPtr("10080"),
1882+
DestinationPortRange: to.StringPtr("80"),
18831883
SourceAddressPrefix: to.StringPtr("Internet"),
1884-
DestinationAddressPrefix: to.StringPtr("*"),
1884+
DestinationAddressPrefix: to.StringPtr("fd00::eef0"),
18851885
Access: network.SecurityRuleAccess("Allow"),
18861886
Priority: to.Int32Ptr(500),
18871887
Direction: network.SecurityRuleDirection("Inbound"),

0 commit comments

Comments
 (0)