3030import io .javaoperatorsdk .operator .config .loader .provider .AgregatePrirityListConfigProvider ;
3131import io .javaoperatorsdk .operator .config .loader .provider .EnvVarConfigProvider ;
3232import io .javaoperatorsdk .operator .config .loader .provider .SystemPropertyConfigProvider ;
33+ import io .javaoperatorsdk .operator .processing .event .rate .LinearRateLimiter ;
3334import io .javaoperatorsdk .operator .processing .retry .GenericRetry ;
3435
3536public class ConfigLoader {
@@ -121,6 +122,12 @@ public static ConfigLoader getDefault() {
121122 static final String RETRY_INTERVAL_MULTIPLIER_SUFFIX = "retry.interval-multiplier" ;
122123 static final String RETRY_MAX_INTERVAL_SUFFIX = "retry.max-interval" ;
123124
125+ // ---------------------------------------------------------------------------
126+ // Controller-level rate-limiter property suffixes
127+ // ---------------------------------------------------------------------------
128+ static final String RATE_LIMITER_REFRESH_PERIOD_SUFFIX = "rate-limiter.refresh-period" ;
129+ static final String RATE_LIMITER_LIMIT_FOR_PERIOD_SUFFIX = "rate-limiter.limit-for-period" ;
130+
124131 // ---------------------------------------------------------------------------
125132 // Controller-level (ControllerConfigurationOverrider) bindings
126133 // The key used at runtime is built as:
@@ -147,7 +154,11 @@ public static ConfigLoader getDefault() {
147154 Boolean .class ,
148155 ControllerConfigurationOverrider ::withTriggerReconcilerOnAllEvents ),
149156 new ConfigBinding <>(
150- "informer-list-limit" ,
157+ "informer.label-selector" ,
158+ String .class ,
159+ ControllerConfigurationOverrider ::withLabelSelector ),
160+ new ConfigBinding <>(
161+ "informer.list-limit" ,
151162 Long .class ,
152163 ControllerConfigurationOverrider ::withInformerListLimit ));
153164
@@ -210,6 +221,11 @@ Consumer<ControllerConfigurationOverrider<R>> applyControllerConfigs(String cont
210221 if (retryStep != null ) {
211222 consumer = consumer == null ? retryStep : consumer .andThen (retryStep );
212223 }
224+ Consumer <ControllerConfigurationOverrider <R >> rateLimiterStep =
225+ buildRateLimiterConsumer (prefix );
226+ if (rateLimiterStep != null ) {
227+ consumer = consumer .andThen (rateLimiterStep );
228+ }
213229 return consumer ;
214230 }
215231
@@ -246,6 +262,32 @@ private <R extends HasMetadata> Consumer<ControllerConfigurationOverrider<R>> bu
246262 };
247263 }
248264
265+ /**
266+ * Returns a {@link Consumer} that builds a {@link LinearRateLimiter} only if {@code
267+ * rate-limiter.limit-for-period} is present and positive (a non-positive value would deactivate
268+ * the limiter and is therefore treated as absent). {@code rate-limiter.refresh-period} is applied
269+ * when also present; otherwise the default refresh period is used. Returns {@code null} when no
270+ * effective rate-limiter configuration is found.
271+ */
272+ private <R extends HasMetadata >
273+ Consumer <ControllerConfigurationOverrider <R >> buildRateLimiterConsumer (String prefix ) {
274+ Optional <Duration > refreshPeriod =
275+ configProvider .getValue (prefix + RATE_LIMITER_REFRESH_PERIOD_SUFFIX , Duration .class );
276+ Optional <Integer > limitForPeriod =
277+ configProvider .getValue (prefix + RATE_LIMITER_LIMIT_FOR_PERIOD_SUFFIX , Integer .class );
278+
279+ if (limitForPeriod .isEmpty () || limitForPeriod .get () <= 0 ) {
280+ return null ;
281+ }
282+
283+ return overrider -> {
284+ var rateLimiter =
285+ new LinearRateLimiter (
286+ refreshPeriod .orElse (LinearRateLimiter .DEFAULT_REFRESH_PERIOD ), limitForPeriod .get ());
287+ overrider .withRateLimiter (rateLimiter );
288+ };
289+ }
290+
249291 /**
250292 * If leader election is explicitly disabled via {@code leader-election.enabled=false}, returns
251293 * {@code null}. Otherwise, if at least one leader-election property is present (with {@code
0 commit comments