@@ -45,6 +45,8 @@ const (
45
45
ILBFinalizerV1 = "gke.networking.io/l4-ilb-v1"
46
46
// ILBFinalizerV2 is the finalizer used by newer controllers that implement Internal LoadBalancer services.
47
47
ILBFinalizerV2 = "gke.networking.io/l4-ilb-v2"
48
+ // maxInstancesPerInstanceGroup defines maximum number of VMs per InstanceGroup.
49
+ maxInstancesPerInstanceGroup = 1000
48
50
)
49
51
50
52
func (g * Cloud ) ensureInternalLoadBalancer (clusterName , clusterID string , svc * v1.Service , existingFwdRule * compute.ForwardingRule , nodes []* v1.Node ) (* v1.LoadBalancerStatus , error ) {
@@ -512,6 +514,17 @@ func (g *Cloud) ensureInternalInstanceGroup(name, zone string, nodes []*v1.Node)
512
514
kubeNodes .Insert (n .Name )
513
515
}
514
516
517
+ // Individual InstanceGroup has a limit for 1000 instances in it.
518
+ // As a result, it's not possible to add more to it.
519
+ // Given that the long-term fix (AlphaFeatureILBSubsets) is already in-progress,
520
+ // to stop the bleeding we now simply cut down the contents to first 1000
521
+ // instances in the alphabetical order. Since there is a limitation for
522
+ // 250 backend VMs for ILB, this isn't making things worse.
523
+ if len (kubeNodes ) > maxInstancesPerInstanceGroup {
524
+ klog .Warningf ("Limiting number of VMs for InstanceGroup %s to %d" , name , maxInstancesPerInstanceGroup )
525
+ kubeNodes = sets .NewString (kubeNodes .List ()[:maxInstancesPerInstanceGroup ]... )
526
+ }
527
+
515
528
gceNodes := sets .NewString ()
516
529
if ig == nil {
517
530
klog .V (2 ).Infof ("ensureInternalInstanceGroup(%v, %v): creating instance group" , name , zone )
0 commit comments