From 9b42f12e4fc59f4d31214d768891e7a86b3d9f87 Mon Sep 17 00:00:00 2001 From: Marc Power Date: Thu, 27 Aug 2020 23:17:59 -0700 Subject: [PATCH] Remove azure-load-balancer-disable-tcp-reset annotation --- .../azure/azure_loadbalancer.go | 6 ++---- .../azure/azure_loadbalancer_test.go | 17 +++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go index e12b9accb50..6e930eb6f07 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go +++ b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go @@ -1007,10 +1007,8 @@ func (az *Cloud) reconcileLoadBalancerRule( var enableTCPReset *bool if az.useStandardLoadBalancer() { enableTCPReset = to.BoolPtr(true) - if v, ok := service.Annotations[ServiceAnnotationLoadBalancerDisableTCPReset]; ok { - klog.Warning("annotation service.beta.kubernetes.io/azure-load-balancer-disable-tcp-reset has been depracated, it would be removed in a future release") - klog.V(2).Infof("reconcileLoadBalancerRule lb name (%s) flag(%s) is set to %s", lbName, ServiceAnnotationLoadBalancerDisableTCPReset, v) - enableTCPReset = to.BoolPtr(!strings.EqualFold(v, "true")) + if _, ok := service.Annotations[ServiceAnnotationLoadBalancerDisableTCPReset]; ok { + klog.Warning("annotation service.beta.kubernetes.io/azure-load-balancer-disable-tcp-reset has been removed as of Kubernetes 1.20. TCP Resets are always enabled on Standard SKU load balancers.") } } diff --git a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer_test.go b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer_test.go index ceb249d3e12..a2dcb75bea0 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer_test.go +++ b/staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer_test.go @@ -1048,9 +1048,10 @@ func TestReconcileLoadBalancerRule(t *testing.T) { wantLb: false, }, { - desc: "reconcileLoadBalancerRule shall return corresponding probe and lbRule(blb)", - service: getTestService("test1", v1.ProtocolTCP, map[string]string{"service.beta.kubernetes.io/azure-load-balancer-disable-tcp-reset": "true"}, false, 80), - wantLb: true, + desc: "reconcileLoadBalancerRule shall return corresponding probe and lbRule(blb)", + service: getTestService("test1", v1.ProtocolTCP, map[string]string{"service.beta.kubernetes.io/azure-load-balancer-disable-tcp-reset": "true"}, false, 80), + loadBalancerSku: "basic", + wantLb: true, expectedProbes: []network.Probe{ { Name: to.StringPtr("atest1-TCP-80"), @@ -1125,7 +1126,7 @@ func TestReconcileLoadBalancerRule(t *testing.T) { ID: to.StringPtr("/subscriptions/subscription/resourceGroups/rg/providers/" + "Microsoft.Network/loadBalancers/lbname/probes/atest1-TCP-80"), }, - EnableTCPReset: to.BoolPtr(false), + EnableTCPReset: to.BoolPtr(true), }, }, }, @@ -1351,7 +1352,7 @@ func TestReconcileLoadBalancer(t *testing.T) { expectedSLb := getTestLoadBalancer(to.StringPtr("testCluster"), to.StringPtr("rg"), to.StringPtr("testCluster"), to.StringPtr("aservice1"), service4, "Standard") (*expectedSLb.LoadBalancerPropertiesFormat.LoadBalancingRules)[0].DisableOutboundSnat = to.BoolPtr(true) - (*expectedSLb.LoadBalancerPropertiesFormat.LoadBalancingRules)[0].EnableTCPReset = to.BoolPtr(false) + (*expectedSLb.LoadBalancerPropertiesFormat.LoadBalancingRules)[0].EnableTCPReset = to.BoolPtr(true) expectedSLb.FrontendIPConfigurations = &[]network.FrontendIPConfiguration{ { Name: to.StringPtr("aservice1"), @@ -1400,7 +1401,7 @@ func TestReconcileLoadBalancer(t *testing.T) { }, } - //change to false to test that reconciliation will fix it + //change to false to test that reconciliation will fix it (despite the fact that disable-tcp-reset was removed in 1.20) (*slb5.LoadBalancerPropertiesFormat.LoadBalancingRules)[0].EnableTCPReset = to.BoolPtr(false) expectedSLb5 := getTestLoadBalancer(to.StringPtr("testCluster"), to.StringPtr("rg"), to.StringPtr("testCluster"), to.StringPtr("aservice1"), service5, "Standard") @@ -1551,7 +1552,7 @@ func TestReconcileLoadBalancer(t *testing.T) { expectedError: nil, }, { - desc: "reconcileLoadBalancer shall remove and reconstruct the correspoind field of lb and set enableTcpReset to false in lbRule", + desc: "reconcileLoadBalancer shall remove and reconstruct the correspoind field of lb and set enableTcpReset to true in lbRule", loadBalancerSku: "standard", service: service4, disableOutboundSnat: to.BoolPtr(true), @@ -1561,7 +1562,7 @@ func TestReconcileLoadBalancer(t *testing.T) { expectedError: nil, }, { - desc: "reconcileLoadBalancer shall remove and reconstruct the correspoind field of lb and set enableTcpReset to true in lbRule", + desc: "reconcileLoadBalancer shall remove and reconstruct the correspoind field of lb and set enableTcpReset (false => true) in lbRule", loadBalancerSku: "standard", service: service5, disableOutboundSnat: to.BoolPtr(true),