Merge pull request #85990 from feiskyer/fix-85989

Fix LoadBalancer rule checking so that no unexpected LoadBalancer updates are made
This commit is contained in:
Kubernetes Prow Robot 2019-12-06 04:06:49 -08:00 committed by GitHub
commit b5040be796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View File

@ -1641,7 +1641,7 @@ func equalLoadBalancingRulePropertiesFormat(s *network.LoadBalancingRuleProperti
reflect.DeepEqual(s.EnableTCPReset, t.EnableTCPReset) &&
reflect.DeepEqual(s.DisableOutboundSnat, t.DisableOutboundSnat)
if wantLB {
if wantLB && s.IdleTimeoutInMinutes != nil && t.IdleTimeoutInMinutes != nil {
return properties && reflect.DeepEqual(s.IdleTimeoutInMinutes, t.IdleTimeoutInMinutes)
}
return properties

View File

@ -173,6 +173,40 @@ func TestFindRule(t *testing.T) {
},
expected: false,
},
{
msg: "rule names match while idletimeout unmatch should return false",
existingRule: []network.LoadBalancingRule{
{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
IdleTimeoutInMinutes: to.Int32Ptr(1),
},
},
},
curRule: network.LoadBalancingRule{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
IdleTimeoutInMinutes: to.Int32Ptr(2),
},
},
expected: false,
},
{
msg: "rule names match while idletimeout nil should return true",
existingRule: []network.LoadBalancingRule{
{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{},
},
},
curRule: network.LoadBalancingRule{
Name: to.StringPtr("httpRule"),
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
IdleTimeoutInMinutes: to.Int32Ptr(2),
},
},
expected: true,
},
{
msg: "rule names match while LoadDistribution unmatch should return false",
existingRule: []network.LoadBalancingRule{