comment on findSecurityRule and fmt

This commit is contained in:
kevinkim 2017-11-21 12:44:15 -08:00
parent d39b517ad3
commit 8514537759
2 changed files with 5 additions and 1 deletions

View File

@ -1205,6 +1205,10 @@ func findRule(rules []network.LoadBalancingRule, rule network.LoadBalancingRule)
return false
}
// 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.
// We intentionally do not compare DestinationAddressPrefixes in consolidated case because reconcileSecurityRule has to consider the two rules equal,
// despite different DestinationAddressPrefixes, in order to give it a chance to consolidate the two rules.
func findSecurityRule(rules []network.SecurityRule, rule network.SecurityRule) bool {
for _, existingRule := range rules {
if !strings.EqualFold(*existingRule.Name, *rule.Name) {

View File

@ -398,7 +398,7 @@ func TestReconcileSecurityGroupFromAnyDestinationAddressPrefixToLoadBalancerIP(t
svc1.Spec.LoadBalancerIP = "192.168.0.0"
sg := getTestSecurityGroup(az)
// Simulate a pre-Kubernetes 1.8 NSG, where we do not specify the destination address prefix
sg,err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(""), true)
sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(""), true)
if err != nil {
t.Errorf("Unexpected error: %q", err)
}