Skip to content

Commit 1280bf7

Browse files
csvirimetacosm
authored andcommitted
improve
Signed-off-by: Attila Mészáros <[email protected]>
1 parent b406787 commit 1280bf7

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
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
/**
@@ -258,7 +258,7 @@ public InformerConfiguration<R> buildForController() {
258258
namespaces = Constants.DEFAULT_NAMESPACES_SET;
259259
}
260260
// to avoid potential NPE
261-
followControllerNamespacesChanges = false;
261+
followsControllerNamespaceChanges = false;
262262
return InformerConfiguration.this;
263263
}
264264

@@ -267,9 +267,9 @@ public InformerConfiguration<R> build() {
267267
if (namespaces == null || namespaces.isEmpty()) {
268268
namespaces = Constants.SAME_AS_CONTROLLER_NAMESPACES_SET;
269269
}
270-
if (followControllerNamespacesChanges == null) {
271-
followControllerNamespacesChanges =
272-
DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE;
270+
if (followsControllerNamespaceChanges == null) {
271+
followsControllerNamespaceChanges =
272+
DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES;
273273
}
274274
return InformerConfiguration.this;
275275
}
@@ -305,7 +305,7 @@ public InformerConfiguration<R>.Builder initFromAnnotation(Informer informerConf
305305
context));
306306

307307
withFollowControllerNamespacesChanges(
308-
informerConfig.followControllerNamespacesOnChange());
308+
informerConfig.followControllerNamespaceChanges());
309309

310310
withItemStore(Utils.instantiate(informerConfig.itemStore(),
311311
ItemStore.class, context));
@@ -373,7 +373,7 @@ public Builder withWatchCurrentNamespace() {
373373
* @return the builder instance so that calls can be chained fluently
374374
*/
375375
public Builder withFollowControllerNamespacesChanges(boolean followChanges) {
376-
InformerConfiguration.this.followControllerNamespacesChanges =
376+
InformerConfiguration.this.followsControllerNamespaceChanges =
377377
followChanges;
378378
return this;
379379
}

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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ void currentNamespaceWatched() {
4747

4848
@Test
4949
void nullLabelSelectorByDefault() {
50-
final var informerConfig =
51-
InformerConfiguration.builder(ConfigMap.class).build();
50+
final var informerConfig = InformerConfiguration.builder(ConfigMap.class).build();
5251
assertNull(informerConfig.getLabelSelector());
5352
}
5453

@@ -61,7 +60,7 @@ void shouldWatchAllNamespacesByDefaultForControllers() {
6160
@Test
6261
void shouldFollowControllerNamespacesByDefaultForInformerEventSource() {
6362
final var informerConfig = InformerConfiguration.builder(ConfigMap.class).build();
64-
assertTrue(informerConfig.getFollowControllerNamespacesChanges());
63+
assertTrue(informerConfig.getFollowsControllerNamespaceChanges());
6564
}
6665

6766
@Test

0 commit comments

Comments
 (0)