Skip to content

Commit 5c986b9

Browse files
committed
improve
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 5daa54d commit 5c986b9

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/Informer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import io.javaoperatorsdk.operator.processing.event.source.filter.OnDeleteFilter;
1414
import io.javaoperatorsdk.operator.processing.event.source.filter.OnUpdateFilter;
1515

16-
import static io.javaoperatorsdk.operator.api.reconciler.Constants.DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE;
16+
import static io.javaoperatorsdk.operator.api.reconciler.Constants.DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES;
1717
import static io.javaoperatorsdk.operator.api.reconciler.Constants.NO_LONG_VALUE_SET;
1818
import static io.javaoperatorsdk.operator.api.reconciler.Constants.NO_VALUE_SET;
1919

@@ -88,7 +88,7 @@
8888
* Set that in case of a runtime controller namespace changes, the informer should also follow the
8989
* new namespace set.
9090
*/
91-
boolean followControllerNamespacesOnChange() default DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE;
91+
boolean followControllerNamespaceChanges() default DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES;
9292

9393
/**
9494
* Replaces the item store used by the informer for the associated primary resource controller.

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class InformerConfiguration<R extends HasMetadata> {
2929
private final String resourceTypeName;
3030
private String name;
3131
private Set<String> namespaces;
32-
private Boolean followControllerNamespacesChanges;
32+
private Boolean followsControllerNamespaceChanges;
3333
private String labelSelector;
3434
private OnAddFilter<? super R> onAddFilter;
3535
private OnUpdateFilter<? super R> onUpdateFilter;
@@ -46,7 +46,7 @@ protected InformerConfiguration(Class<R> resourceClass, String name, Set<String>
4646
this(resourceClass);
4747
this.name = name;
4848
this.namespaces = namespaces;
49-
this.followControllerNamespacesChanges = followControllerNamespacesOnChange;
49+
this.followsControllerNamespaceChanges = followControllerNamespacesOnChange;
5050
this.labelSelector = labelSelector;
5151
this.onAddFilter = onAddFilter;
5252
this.onUpdateFilter = onUpdateFilter;
@@ -75,7 +75,7 @@ public static <R extends HasMetadata> InformerConfiguration<R>.Builder builder(
7575
public static <R extends HasMetadata> InformerConfiguration<R>.Builder builder(
7676
InformerConfiguration<R> original) {
7777
return new InformerConfiguration(original.resourceClass, original.name, original.namespaces,
78-
original.followControllerNamespacesChanges, original.labelSelector, original.onAddFilter,
78+
original.followsControllerNamespaceChanges, original.labelSelector, original.onAddFilter,
7979
original.onUpdateFilter, original.onDeleteFilter, original.genericFilter,
8080
original.itemStore, original.informerListLimit).builder;
8181
}
@@ -184,8 +184,8 @@ public Set<String> getEffectiveNamespaces(ControllerConfiguration<?> controllerC
184184
*
185185
* @return if namespace changes should be followed
186186
*/
187-
public boolean getFollowControllerNamespacesChanges() {
188-
return followControllerNamespacesChanges;
187+
public boolean getFollowsControllerNamespaceChanges() {
188+
return followsControllerNamespaceChanges;
189189
}
190190

191191
/**
@@ -257,17 +257,17 @@ public InformerConfiguration<R> buildForController() {
257257
namespaces = Constants.DEFAULT_NAMESPACES_SET;
258258
}
259259
// to avoid potential NPE
260-
followControllerNamespacesChanges = false;
260+
followsControllerNamespaceChanges = false;
261261
return InformerConfiguration.this;
262262
}
263263

264264
public InformerConfiguration<R> buildForInformerEventSource() {
265265
if (namespaces == null || namespaces.isEmpty()) {
266266
namespaces = Constants.SAME_AS_CONTROLLER_NAMESPACES_SET;
267267
}
268-
if (followControllerNamespacesChanges == null) {
269-
followControllerNamespacesChanges =
270-
DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE;
268+
if (followsControllerNamespaceChanges == null) {
269+
followsControllerNamespaceChanges =
270+
DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES;
271271
}
272272
return InformerConfiguration.this;
273273
}
@@ -303,7 +303,7 @@ public InformerConfiguration<R>.Builder initFromAnnotation(Informer informerConf
303303
context));
304304

305305
withFollowControllerNamespacesChanges(
306-
informerConfig.followControllerNamespacesOnChange());
306+
informerConfig.followControllerNamespaceChanges());
307307

308308
withItemStore(Utils.instantiate(informerConfig.itemStore(),
309309
ItemStore.class, context));
@@ -371,7 +371,7 @@ public Builder withWatchCurrentNamespace() {
371371
* @return the builder instance so that calls can be chained fluently
372372
*/
373373
public Builder withFollowControllerNamespacesChanges(boolean followChanges) {
374-
InformerConfiguration.this.followControllerNamespacesChanges =
374+
InformerConfiguration.this.followsControllerNamespaceChanges =
375375
followChanges;
376376
return this;
377377
}

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static Builder<GenericKubernetesResource> from(
3535
* @return if namespace changes should be followed
3636
*/
3737
default boolean followControllerNamespaceChanges() {
38-
return getInformerConfig().getFollowControllerNamespacesChanges();
38+
return getInformerConfig().getFollowsControllerNamespaceChanges();
3939
}
4040

4141
/**
@@ -195,7 +195,7 @@ public void updateFrom(InformerConfiguration<R> informerConfig) {
195195
}
196196
config.withNamespaces(informerConfig.getNamespaces())
197197
.withFollowControllerNamespacesChanges(
198-
informerConfig.getFollowControllerNamespacesChanges())
198+
informerConfig.getFollowsControllerNamespaceChanges())
199199
.withLabelSelector(informerConfig.getLabelSelector())
200200
.withItemStore(informerConfig.getItemStore())
201201
.withOnAddFilter(informerConfig.getOnAddFilter())

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class Constants {
2525

2626
public static final String RESOURCE_GVK_KEY = "josdk.resource.gvk";
2727
public static final String CONTROLLER_NAME = "controller.name";
28-
public static final boolean DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE = true;
28+
public static final boolean DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES = true;
2929

3030
private Constants() {}
3131
}

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/InformerConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void shouldWatchAllNamespacesByDefaultForControllers() {
6262
void shouldFollowControllerNamespacesByDefaultForInformerEventSource() {
6363
final var informerConfig =
6464
InformerConfiguration.builder(ConfigMap.class).buildForInformerEventSource();
65-
assertTrue(informerConfig.getFollowControllerNamespacesChanges());
65+
assertTrue(informerConfig.getFollowsControllerNamespaceChanges());
6666
}
6767

6868
@Test

0 commit comments

Comments
 (0)