mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
comment on findSecurityRule and fmt
This commit is contained in:
parent
d39b517ad3
commit
8514537759
@ -1205,6 +1205,10 @@ func findRule(rules []network.LoadBalancingRule, rule network.LoadBalancingRule)
|
|||||||
return false
|
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 {
|
func findSecurityRule(rules []network.SecurityRule, rule network.SecurityRule) bool {
|
||||||
for _, existingRule := range rules {
|
for _, existingRule := range rules {
|
||||||
if !strings.EqualFold(*existingRule.Name, *rule.Name) {
|
if !strings.EqualFold(*existingRule.Name, *rule.Name) {
|
||||||
|
@ -398,7 +398,7 @@ func TestReconcileSecurityGroupFromAnyDestinationAddressPrefixToLoadBalancerIP(t
|
|||||||
svc1.Spec.LoadBalancerIP = "192.168.0.0"
|
svc1.Spec.LoadBalancerIP = "192.168.0.0"
|
||||||
sg := getTestSecurityGroup(az)
|
sg := getTestSecurityGroup(az)
|
||||||
// Simulate a pre-Kubernetes 1.8 NSG, where we do not specify the destination address prefix
|
// 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 {
|
if err != nil {
|
||||||
t.Errorf("Unexpected error: %q", err)
|
t.Errorf("Unexpected error: %q", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user