mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-25 06:40:21 +00:00
azure: loadbalancer: fix sourceAddrPrefix support
Fixes support for multiple instances of loadBalancerSourceRanges. Previously, the names of the rules for each address range conflicted causing only one to be applied. Now each gets a unique name.
This commit is contained in:
@@ -503,11 +503,11 @@ func (az *Cloud) reconcileLoadBalancer(lb network.LoadBalancer, fipConfiguration
|
||||
} else {
|
||||
ports = []v1.ServicePort{}
|
||||
}
|
||||
lbRuleName := getRuleName(service, port)
|
||||
|
||||
var expectedProbes []network.Probe
|
||||
var expectedRules []network.LoadBalancingRule
|
||||
for _, port := range ports {
|
||||
lbRuleName := getLoadBalancerRuleName(service, port)
|
||||
|
||||
transportProto, _, probeProto, err := getProtocolsFromKubernetesProtocol(port.Protocol)
|
||||
if err != nil {
|
||||
@@ -690,13 +690,13 @@ func (az *Cloud) reconcileSecurityGroup(sg network.SecurityGroup, clusterName st
|
||||
expectedSecurityRules := make([]network.SecurityRule, len(ports)*len(sourceAddressPrefixes))
|
||||
|
||||
for i, port := range ports {
|
||||
securityRuleName := getRuleName(service, port)
|
||||
_, securityProto, _, err := getProtocolsFromKubernetesProtocol(port.Protocol)
|
||||
if err != nil {
|
||||
return sg, false, err
|
||||
}
|
||||
for j := range sourceAddressPrefixes {
|
||||
ix := i*len(sourceAddressPrefixes) + j
|
||||
securityRuleName := getSecurityRuleName(service, port, sourceAddressPrefixes[j])
|
||||
expectedSecurityRules[ix] = network.SecurityRule{
|
||||
Name: to.StringPtr(securityRuleName),
|
||||
SecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{
|
||||
|
||||
Reference in New Issue
Block a user