Unverified Commit d193fbe4 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #71484 from ritazh/nsg-srcrange-collapse

Collapse not shared NSG rules with multiple source ranges
parents b1aed159 61fbba74
...@@ -236,6 +236,11 @@ func (az *Cloud) getSecurityRuleName(service *v1.Service, port v1.ServicePort, s ...@@ -236,6 +236,11 @@ func (az *Cloud) getSecurityRuleName(service *v1.Service, port v1.ServicePort, s
safePrefix := strings.Replace(sourceAddrPrefix, "/", "_", -1) safePrefix := strings.Replace(sourceAddrPrefix, "/", "_", -1)
return fmt.Sprintf("shared-%s-%d-%s", port.Protocol, port.Port, safePrefix) return fmt.Sprintf("shared-%s-%d-%s", port.Protocol, port.Port, safePrefix)
} }
if sourceAddrPrefix == "" {
rulePrefix := az.getRulePrefix(service)
return fmt.Sprintf("%s-%s-%d", rulePrefix, port.Protocol, port.Port)
}
// ensure backward compatibility
safePrefix := strings.Replace(sourceAddrPrefix, "/", "_", -1) safePrefix := strings.Replace(sourceAddrPrefix, "/", "_", -1)
rulePrefix := az.getRulePrefix(service) rulePrefix := az.getRulePrefix(service)
return fmt.Sprintf("%s-%s-%d-%s", rulePrefix, port.Protocol, port.Port, safePrefix) return fmt.Sprintf("%s-%s-%d-%s", rulePrefix, port.Protocol, port.Port, safePrefix)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment