skip ilb creation if subsetting is enabled.

This commit is contained in:
Pavithra Ramesh 2019-07-15 22:04:47 -07:00
parent d79d4e8525
commit acaa16c272
2 changed files with 9 additions and 4 deletions

View File

@ -26,6 +26,7 @@ const (
//
// alpha: v1.8 (for Services)
AlphaFeatureNetworkTiers = "NetworkTiers"
AlphaFeatureILBSubsets = "ILBSubsets"
)
// AlphaFeatureGate contains a mapping of alpha features to whether they are enabled

View File

@ -36,9 +36,13 @@ const (
allInstances = "ALL"
)
func (g *Cloud) usesSubsets() bool {
return g.AlphaFeatureGate != nil && g.AlphaFeatureGate.Enabled(AlphaFeatureILBSubsets)
}
func (g *Cloud) ensureInternalLoadBalancer(clusterName, clusterID string, svc *v1.Service, existingFwdRule *compute.ForwardingRule, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) {
if g.AlphaFeatureGate.Enabled("ILBSubsets") {
return nil, cloudprovider.NotImplemented
if g.usesSubsets() {
return nil, cloudprovider.ImplementedElsewhere
}
nm := types.NamespacedName{Name: svc.Name, Namespace: svc.Namespace}
@ -206,8 +210,8 @@ func (g *Cloud) clearPreviousInternalResources(svc *v1.Service, loadBalancerName
// updateInternalLoadBalancer is called when the list of nodes has changed. Therefore, only the instance groups
// and possibly the backend service need to be updated.
func (g *Cloud) updateInternalLoadBalancer(clusterName, clusterID string, svc *v1.Service, nodes []*v1.Node) error {
if g.AlphaFeatureGate.Enabled("ILBSubsets") {
return cloudprovider.NotImplemented
if g.usesSubsets() {
return cloudprovider.ImplementedElsewhere
}
g.sharedResourceLock.Lock()
defer g.sharedResourceLock.Unlock()