@@ -34,6 +34,7 @@ const (
3434 flagBackendSecurityGroup = "backend-security-group"
3535 flagEnableEndpointSlices = "enable-endpoint-slices"
3636 flagDisableRestrictedSGRules = "disable-restricted-sg-rules"
37+ flagMaxTargetsPerInstance = "max-targets-per-instance"
3738 defaultLogLevel = "info"
3839 defaultMaxConcurrentReconciles = 3
3940 defaultMaxExponentialBackoffDelay = time .Second * 1000
@@ -43,6 +44,7 @@ const (
4344 defaultEnableEndpointSlices = true
4445 defaultDisableRestrictedSGRules = false
4546 defaultLbStabilizationMonitorInterval = time .Second * 120
47+ defaultMaxTargetsPerInstance = 0
4648)
4749
4850var (
@@ -133,6 +135,9 @@ type ControllerConfig struct {
133135 // LBStabilizationMonitorInterval specifies the duration of interval to monitor the load balancer state for stabilization
134136 LBStabilizationMonitorInterval time.Duration
135137
138+ // MaxTargetsPerInstance limits the number of targets that will be added to an ELB instance
139+ MaxTargetsPerInstance int
140+
136141 FeatureGates FeatureGates
137142}
138143
@@ -177,6 +182,8 @@ func (cfg *ControllerConfig) BindFlags(fs *pflag.FlagSet) {
177182 "Disable the usage of restricted security group rules" )
178183 fs .StringToStringVar (& cfg .ServiceTargetENISGTags , flagServiceTargetENISGTags , nil ,
179184 "AWS Tags, in addition to cluster tags, for finding the target ENI security group to which to add inbound rules from NLBs" )
185+ fs .IntVar (& cfg .MaxTargetsPerInstance , flagMaxTargetsPerInstance , defaultMaxTargetsPerInstance ,
186+ "Maximum number of targets that can be added to an ELB instance. Use this to prevent TargetGroup quotas being exceeded from blocking reconciliation." )
180187 cfg .FeatureGates .BindFlags (fs )
181188 cfg .AWSConfig .BindFlags (fs )
182189 cfg .RuntimeConfig .BindFlags (fs )
0 commit comments