Skip to content

Commit b5040be

Browse files
authored
Merge pull request kubernetes#85990 from feiskyer/fix-85989
Fix LoadBalancer rule checking so that no unexpected LoadBalancer updates are made
2 parents 93c9085 + dd50ac3 commit b5040be

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ func equalLoadBalancingRulePropertiesFormat(s *network.LoadBalancingRuleProperti
16411641
reflect.DeepEqual(s.EnableTCPReset, t.EnableTCPReset) &&
16421642
reflect.DeepEqual(s.DisableOutboundSnat, t.DisableOutboundSnat)
16431643

1644-
if wantLB {
1644+
if wantLB && s.IdleTimeoutInMinutes != nil && t.IdleTimeoutInMinutes != nil {
16451645
return properties && reflect.DeepEqual(s.IdleTimeoutInMinutes, t.IdleTimeoutInMinutes)
16461646
}
16471647
return properties

staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,40 @@ func TestFindRule(t *testing.T) {
173173
},
174174
expected: false,
175175
},
176+
{
177+
msg: "rule names match while idletimeout unmatch should return false",
178+
existingRule: []network.LoadBalancingRule{
179+
{
180+
Name: to.StringPtr("httpRule"),
181+
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
182+
IdleTimeoutInMinutes: to.Int32Ptr(1),
183+
},
184+
},
185+
},
186+
curRule: network.LoadBalancingRule{
187+
Name: to.StringPtr("httpRule"),
188+
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
189+
IdleTimeoutInMinutes: to.Int32Ptr(2),
190+
},
191+
},
192+
expected: false,
193+
},
194+
{
195+
msg: "rule names match while idletimeout nil should return true",
196+
existingRule: []network.LoadBalancingRule{
197+
{
198+
Name: to.StringPtr("httpRule"),
199+
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{},
200+
},
201+
},
202+
curRule: network.LoadBalancingRule{
203+
Name: to.StringPtr("httpRule"),
204+
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
205+
IdleTimeoutInMinutes: to.Int32Ptr(2),
206+
},
207+
},
208+
expected: true,
209+
},
176210
{
177211
msg: "rule names match while LoadDistribution unmatch should return false",
178212
existingRule: []network.LoadBalancingRule{

0 commit comments

Comments
 (0)