@@ -27,17 +27,16 @@ public class ConfigLoader {
2727
2828 public static final ConfigLoader DEFAULT = new ConfigLoader ();
2929
30- /**
31- * Key prefix for operator-level (ConfigurationService) properties, e.g. {@code
32- * josdk.concurrent.reconciliation.threads}.
33- */
34- public static final String OPERATOR_KEY_PREFIX = "josdk." ;
30+ public static final String DEFAULT_OPERATOR_KEY_PREFIX = "josdk." ;
31+ public static final String DEFAULT_CONTROLLER_KEY_PREFIX = "josdk.controller." ;
3532
3633 /**
3734 * Key prefix for controller-level properties. The controller name is inserted between this prefix
3835 * and the property name, e.g. {@code josdk.controller.my-controller.finalizer}.
3936 */
40- public static final String CONTROLLER_KEY_PREFIX = "josdk.controller." ;
37+ private final String controllerKeyPrefix ;
38+
39+ private final String operatorKeyPrefix ;
4140
4241 // ---------------------------------------------------------------------------
4342 // Operator-level (ConfigurationServiceOverrider) bindings
@@ -48,43 +47,43 @@ public class ConfigLoader {
4847 private static final List <ConfigBinding <ConfigurationServiceOverrider , ?>> OPERATOR_BINDINGS =
4948 List .of (
5049 new ConfigBinding <>(
51- OPERATOR_KEY_PREFIX + "check. crd.and.validate.local.model " ,
50+ "check- crd" ,
5251 Boolean .class ,
5352 ConfigurationServiceOverrider ::checkingCRDAndValidateLocalModel ),
5453 new ConfigBinding <>(
55- OPERATOR_KEY_PREFIX + "concurrent.reconciliation.threads" ,
54+ "reconciliation.termination-timeout" ,
55+ Duration .class ,
56+ ConfigurationServiceOverrider ::withReconciliationTerminationTimeout ),
57+ new ConfigBinding <>(
58+ "reconciliation.concurrent-threads" ,
5659 Integer .class ,
5760 ConfigurationServiceOverrider ::withConcurrentReconciliationThreads ),
5861 new ConfigBinding <>(
59- OPERATOR_KEY_PREFIX + "concurrent. workflow.executor. threads" ,
62+ " workflow.executor- threads" ,
6063 Integer .class ,
6164 ConfigurationServiceOverrider ::withConcurrentWorkflowExecutorThreads ),
6265 new ConfigBinding <>(
63- OPERATOR_KEY_PREFIX + "close. client.on. stop" ,
66+ "close- client-on- stop" ,
6467 Boolean .class ,
6568 ConfigurationServiceOverrider ::withCloseClientOnStop ),
6669 new ConfigBinding <>(
67- OPERATOR_KEY_PREFIX + "stop.on. informer.error. during. startup" ,
70+ " informer.stop-on- error- during- startup" ,
6871 Boolean .class ,
6972 ConfigurationServiceOverrider ::withStopOnInformerErrorDuringStartup ),
7073 new ConfigBinding <>(
71- OPERATOR_KEY_PREFIX + "cache. sync. timeout" ,
74+ "informer.cache- sync- timeout" ,
7275 Duration .class ,
7376 ConfigurationServiceOverrider ::withCacheSyncTimeout ),
7477 new ConfigBinding <>(
75- OPERATOR_KEY_PREFIX + "reconciliation.termination.timeout" ,
76- Duration .class ,
77- ConfigurationServiceOverrider ::withReconciliationTerminationTimeout ),
78- new ConfigBinding <>(
79- OPERATOR_KEY_PREFIX + "ssa.based.create.update.match.for.dependent.resources" ,
78+ "dependent-resources.ssa-based-create-update-match" ,
8079 Boolean .class ,
8180 ConfigurationServiceOverrider ::withSSABasedCreateUpdateMatchForDependentResources ),
8281 new ConfigBinding <>(
83- OPERATOR_KEY_PREFIX + "use. ssa.to. patch. primary. resource" ,
82+ "use- ssa-to- patch- primary- resource" ,
8483 Boolean .class ,
8584 ConfigurationServiceOverrider ::withUseSSAToPatchPrimaryResource ),
8685 new ConfigBinding <>(
87- OPERATOR_KEY_PREFIX + "clone. secondary. resources. when. getting. from. cache" ,
86+ "clone- secondary- resources- when- getting- from- cache" ,
8887 Boolean .class ,
8988 ConfigurationServiceOverrider ::withCloneSecondaryResourcesWhenGettingFromCache ));
9089
@@ -99,47 +98,54 @@ public class ConfigLoader {
9998 new ConfigBinding <>(
10099 "finalizer" , String .class , ControllerConfigurationOverrider ::withFinalizer ),
101100 new ConfigBinding <>(
102- "generation. aware" ,
101+ "generation- aware" ,
103102 Boolean .class ,
104103 ControllerConfigurationOverrider ::withGenerationAware ),
105104 new ConfigBinding <>(
106- "label. selector" ,
105+ "label- selector" ,
107106 String .class ,
108107 ControllerConfigurationOverrider ::withLabelSelector ),
109108 new ConfigBinding <>(
110- "reconciliation. max. interval" ,
109+ "max-reconciliation- interval" ,
111110 Duration .class ,
112111 ControllerConfigurationOverrider ::withReconciliationMaxInterval ),
113112 new ConfigBinding <>(
114- "field. manager" ,
113+ "field- manager" ,
115114 String .class ,
116115 ControllerConfigurationOverrider ::withFieldManager ),
117116 new ConfigBinding <>(
118- "trigger. reconciler.on. all. events" ,
117+ "trigger- reconciler-on- all- events" ,
119118 Boolean .class ,
120119 ControllerConfigurationOverrider ::withTriggerReconcilerOnAllEvents ),
121120 new ConfigBinding <>(
122- "informer. list. limit" ,
121+ "informer- list- limit" ,
123122 Long .class ,
124123 ControllerConfigurationOverrider ::withInformerListLimit ));
125124
126125 private final ConfigProvider configProvider ;
127126
128127 public ConfigLoader () {
129- this (new DefaultConfigProvider ());
128+ this (new DefaultConfigProvider (), DEFAULT_CONTROLLER_KEY_PREFIX , DEFAULT_OPERATOR_KEY_PREFIX );
130129 }
131130
132131 public ConfigLoader (ConfigProvider configProvider ) {
132+ this (configProvider , DEFAULT_CONTROLLER_KEY_PREFIX , DEFAULT_OPERATOR_KEY_PREFIX );
133+ }
134+
135+ public ConfigLoader (
136+ ConfigProvider configProvider , String controllerKeyPrefix , String operatorKeyPrefix ) {
133137 this .configProvider = configProvider ;
138+ this .controllerKeyPrefix = controllerKeyPrefix ;
139+ this .operatorKeyPrefix = operatorKeyPrefix ;
134140 }
135141
136142 /**
137143 * Returns a {@link Consumer} that applies every operator-level property found in the {@link
138144 * ConfigProvider} to the given {@link ConfigurationServiceOverrider}. Returns {@code null} when
139- * no binding has a matching value, preserving the previous behaviour .
145+ * no binding has a matching value, preserving the previous behavior .
140146 */
141147 public Consumer <ConfigurationServiceOverrider > applyConfigs () {
142- return buildConsumer (OPERATOR_BINDINGS , null );
148+ return buildConsumer (OPERATOR_BINDINGS , operatorKeyPrefix );
143149 }
144150
145151 /**
@@ -151,7 +157,7 @@ public Consumer<ConfigurationServiceOverrider> applyConfigs() {
151157 @ SuppressWarnings ("unchecked" )
152158 public <R extends HasMetadata >
153159 Consumer <ControllerConfigurationOverrider <R >> applyControllerConfigs (String controllerName ) {
154- String prefix = CONTROLLER_KEY_PREFIX + controllerName + "." ;
160+ String prefix = controllerKeyPrefix + controllerName + "." ;
155161 // Cast is safe: the setter BiConsumer<ControllerConfigurationOverrider<?>, T> is covariant in
156162 // its first parameter for our usage – we only ever call it with
157163 // ControllerConfigurationOverrider<R>.
0 commit comments