From 08dc0fc65e8ec9df29477d901d352dbc53f77911 Mon Sep 17 00:00:00 2001 From: Pavithra Ramesh Date: Mon, 2 Mar 2020 11:53:14 -0800 Subject: [PATCH] Remove feature gate for ILB Custom Subnet. --- .../legacy-cloud-providers/gce/gce_alpha.go | 3 --- .../gce/gce_loadbalancer_internal.go | 26 +++++-------------- .../gce/gce_loadbalancer_internal_test.go | 1 - 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_alpha.go b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_alpha.go index 98c31e5acbf..6f4821b69d4 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_alpha.go +++ b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_alpha.go @@ -22,9 +22,6 @@ const ( // AlphaFeatureILBSubsets allows InternalLoadBalancer services to include a subset // of cluster nodes as backends instead of all nodes. AlphaFeatureILBSubsets = "ILBSubsets" - // AlphaFeatureILBCustomSubnet allows InternalLoadBalancer services to specify a - // network subnet to allocate ip addresses from. - AlphaFeatureILBCustomSubnet = "ILBCustomSubnet" ) // AlphaFeatureGate contains a mapping of alpha features to whether they are enabled diff --git a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal.go b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal.go index cf35e1a3426..b701fbd3e32 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal.go +++ b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal.go @@ -90,12 +90,6 @@ func (g *Cloud) ensureInternalLoadBalancer(clusterName, clusterID string, svc *v g.eventRecorder.Event(svc, v1.EventTypeWarning, "ILBOptionsIgnored", "Internal LoadBalancer options are not supported with Legacy Networks.") options = ILBOptions{} } - if !g.AlphaFeatureGate.Enabled(AlphaFeatureILBCustomSubnet) { - if options.SubnetName != "" { - g.eventRecorder.Event(svc, v1.EventTypeWarning, "ILBCustomSubnetOptionIgnored", "Internal LoadBalancer CustomSubnet options ignored as the feature gate is disabled.") - options.SubnetName = "" - } - } sharedBackend := shareBackendService(svc) backendServiceName := makeBackendServiceName(loadBalancerName, clusterID, sharedBackend, scheme, protocol, svc.Spec.SessionAffinity) @@ -136,20 +130,12 @@ func (g *Cloud) ensureInternalLoadBalancer(clusterName, clusterID string, svc *v } subnetworkURL := g.SubnetworkURL() - if g.AlphaFeatureGate.Enabled(AlphaFeatureILBCustomSubnet) { - // If this feature is enabled, changes to subnet annotation will be - // picked up and reflected in the forwarding rule. - // Removing the annotation will set the forwarding rule to use the default subnet. - if options.SubnetName != "" { - subnetworkURL = gceSubnetworkURL("", g.networkProjectID, g.region, options.SubnetName) - } - } else { - // TODO(84885) remove this once ILBCustomSubnet goes beta. - if existingFwdRule != nil && existingFwdRule.Subnetwork != "" { - // If the ILB already exists, continue using the subnet that it's already using. - // This is to support existing ILBs that were setup using the wrong subnet - https://github.com/kubernetes/kubernetes/pull/57861 - subnetworkURL = existingFwdRule.Subnetwork - } + // Any subnet specified using the subnet annotation will be picked up and reflected in the forwarding rule. + // Removing the annotation will set the forwarding rule to use the default subnet and result in a VIP change. + // In order to support existing ILBs that were setup using the wrong subnet - https://github.com/kubernetes/kubernetes/pull/57861, + // users will need to specify that subnet with the annotation. + if options.SubnetName != "" { + subnetworkURL = gceSubnetworkURL("", g.networkProjectID, g.region, options.SubnetName) } // Determine IP which will be used for this LB. If no forwarding rule has been established // or specified in the Service spec, then requestedIP = "". diff --git a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal_test.go b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal_test.go index d36b83e1439..e1e736c7e6f 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal_test.go +++ b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_loadbalancer_internal_test.go @@ -1381,7 +1381,6 @@ func TestEnsureInternalLoadBalancerCustomSubnet(t *testing.T) { vals := DefaultTestClusterValues() gce, err := fakeGCECloud(vals) require.NoError(t, err) - gce.AlphaFeatureGate = NewAlphaFeatureGate([]string{AlphaFeatureILBCustomSubnet}) nodeNames := []string{"test-node-1"} nodes, err := createAndInsertNodes(gce, nodeNames, vals.ZoneName)