klog.V(4).Infof("Expected to find destination address %s in shared rule %s for service %s being deleted, but did not",destinationIPAddress,sharedRuleName,service.Name)
returnnil,fmt.Errorf("Expected to find destination address %s in shared rule %s for service %s being deleted, but did not",destinationIPAddress,sharedRuleName,service.Name)
returnnil,fmt.Errorf("Expected to find destination address %s in shared rule %s for service %s being deleted, but did not",destinationIPAddress,sharedRuleName,service.Name)
}
}
iflen(existingPrefixes)==1{
iflen(existingPrefixes)==1{
...
@@ -1131,26 +1118,10 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
...
@@ -1131,26 +1118,10 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
@@ -1521,19 +1473,12 @@ func equalLoadBalancingRulePropertiesFormat(s, t *network.LoadBalancingRulePrope
...
@@ -1521,19 +1473,12 @@ func equalLoadBalancingRulePropertiesFormat(s, t *network.LoadBalancingRulePrope
// This compares rule's Name, Protocol, SourcePortRange, DestinationPortRange, SourceAddressPrefix, Access, and Direction.
// This compares rule's Name, Protocol, SourcePortRange, DestinationPortRange, SourceAddressPrefix, Access, and Direction.
// Note that it compares rule's DestinationAddressPrefix only when it's not consolidated rule as such rule does not have DestinationAddressPrefix defined.
// Note that it compares rule's DestinationAddressPrefix only when it's not consolidated rule as such rule does not have DestinationAddressPrefix defined.
// We intentionally do not compare SourceAddressPrefixes and DestinationAddressPrefixes in consolidated case because reconcileSecurityRule has to consider the two rules equal,
// We intentionally do not compare DestinationAddressPrefixes in consolidated case because reconcileSecurityRule has to consider the two rules equal,
// despite different SourceAddressPrefixes and DestinationAddressPrefixes, in order to give it a chance to consolidate the two rules.
// despite different DestinationAddressPrefixes, in order to give it a chance to consolidate the two rules.
t.Errorf("Shared rule %s should have had %d source addresses but had %d",expectedRuleName,expectedSourceAddressPrefixesCount,len(*securityRule.SourceAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName11,expectedDestinationIPCount11,len(*securityRule11.DestinationAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName1,expectedDestinationIPCount1,len(*securityRule1.DestinationAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName2,expectedDestinationIPCount2,len(*securityRule2.DestinationAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName13,expectedDestinationIPCount13,len(*securityRule13.DestinationAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName13,expectedDestinationIPCount13,len(*securityRule13.DestinationAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName13,expectedDestinationIPCount13,len(*securityRule13.DestinationAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName4,expectedSourceIPCount4,len(*securityRule4.SourceAddressPrefixes))
}
ifsecurityRule4.DestinationAddressPrefixes!=nil{
ifsecurityRule4.DestinationAddressPrefixes!=nil{
t.Errorf("Expected unshared rule %s to use single destination IP address but used collection",expectedRuleName4)
t.Errorf("Expected unshared rule %s to use single destination IP address but used collection",expectedRuleName4)
t.Errorf("Expected rule %s should have had %d source IP addresses but had %d",expectedRuleName4,expectedSourceAddressCount4,len(*securityRule4.SourceAddressPrefixes))
}
ifsecurityRule5.DestinationAddressPrefixes!=nil{
ifsecurityRule5.DestinationAddressPrefixes!=nil{
t.Errorf("Expected unshared rule %s to use single destination IP address but used collection",expectedRuleName5)
t.Errorf("Expected unshared rule %s to use single destination IP address but used collection",expectedRuleName5)
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName13,expectedDestinationIPCount13,len(*securityRule13.DestinationAddressPrefixes))
t.Errorf("Shared rule %s should have had %d destination IP addresses but had %d",expectedRuleName13,expectedDestinationIPCount13,len(*securityRule13.DestinationAddressPrefixes))
t.Errorf("Expected unshared rule %s to have %d source addresses but it has %d",expectedRuleName1,expectedSourceAddressCount,len(*securityRule1.SourceAddressPrefixes))
t.Errorf("Expected unshared rule %s to have %d source addresses but it has %d",expectedRuleName1,expectedSourceAddressCount,len(*securityRule1.SourceAddressPrefixes))
}
ifsecurityRule1.Priority!=existingPriority{
t.Errorf("Expected unshared rule %s to have priority %d but it has %d",expectedRuleName1,existingPriority,securityRule1.Priority)
}
}
}
// TODO: sanity check if the same IP address incorrectly gets put in twice?
// TODO: sanity check if the same IP address incorrectly gets put in twice?