Skip to content

Commit b406787

Browse files
csvirimetacosm
authored andcommitted
improve: follow namespace changes method naming
Signed-off-by: Attila Mészáros <[email protected]>
1 parent b25a399 commit b406787

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

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

Lines changed: 12 additions & 12 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 followControllerNamespacesOnChange;
32+
private Boolean followControllerNamespacesChanges;
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.followControllerNamespacesOnChange = followControllerNamespacesOnChange;
49+
this.followControllerNamespacesChanges = 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.followControllerNamespacesOnChange, original.labelSelector, original.onAddFilter,
78+
original.followControllerNamespacesChanges, 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 isFollowControllerNamespacesOnChange() {
188-
return followControllerNamespacesOnChange;
187+
public boolean getFollowControllerNamespacesChanges() {
188+
return followControllerNamespacesChanges;
189189
}
190190

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

@@ -267,8 +267,8 @@ public InformerConfiguration<R> build() {
267267
if (namespaces == null || namespaces.isEmpty()) {
268268
namespaces = Constants.SAME_AS_CONTROLLER_NAMESPACES_SET;
269269
}
270-
if (followControllerNamespacesOnChange == null) {
271-
followControllerNamespacesOnChange =
270+
if (followControllerNamespacesChanges == null) {
271+
followControllerNamespacesChanges =
272272
DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE;
273273
}
274274
return InformerConfiguration.this;
@@ -304,7 +304,7 @@ public InformerConfiguration<R>.Builder initFromAnnotation(Informer informerConf
304304
GenericFilter.class,
305305
context));
306306

307-
withFollowControllerNamespacesOnChange(
307+
withFollowControllerNamespacesChanges(
308308
informerConfig.followControllerNamespacesOnChange());
309309

310310
withItemStore(Utils.instantiate(informerConfig.itemStore(),
@@ -344,7 +344,7 @@ public Set<String> namespaces() {
344344
* @return the builder instance so that calls can be chained fluently
345345
*/
346346
public Builder withNamespaces(Set<String> namespaces, boolean followChanges) {
347-
withNamespaces(namespaces).withFollowControllerNamespacesOnChange(followChanges);
347+
withNamespaces(namespaces).withFollowControllerNamespacesChanges(followChanges);
348348
return this;
349349
}
350350

@@ -372,8 +372,8 @@ public Builder withWatchCurrentNamespace() {
372372
* controller's namespaces are reconfigured, {@code false} otherwise
373373
* @return the builder instance so that calls can be chained fluently
374374
*/
375-
public Builder withFollowControllerNamespacesOnChange(boolean followChanges) {
376-
InformerConfiguration.this.followControllerNamespacesOnChange =
375+
public Builder withFollowControllerNamespacesChanges(boolean followChanges) {
376+
InformerConfiguration.this.followControllerNamespacesChanges =
377377
followChanges;
378378
return this;
379379
}

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

Lines changed: 3 additions & 3 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().isFollowControllerNamespacesOnChange();
38+
return getInformerConfig().getFollowControllerNamespacesChanges();
3939
}
4040

4141
/**
@@ -194,8 +194,8 @@ public void updateFrom(InformerConfiguration<R> informerConfig) {
194194
this.name = informerConfigName;
195195
}
196196
config.withNamespaces(informerConfig.getNamespaces())
197-
.withFollowControllerNamespacesOnChange(
198-
informerConfig.isFollowControllerNamespacesOnChange())
197+
.withFollowControllerNamespacesChanges(
198+
informerConfig.getFollowControllerNamespacesChanges())
199199
.withLabelSelector(informerConfig.getLabelSelector())
200200
.withItemStore(informerConfig.getItemStore())
201201
.withOnAddFilter(informerConfig.getOnAddFilter())

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
@@ -60,9 +60,8 @@ void shouldWatchAllNamespacesByDefaultForControllers() {
6060

6161
@Test
6262
void shouldFollowControllerNamespacesByDefaultForInformerEventSource() {
63-
final var informerConfig =
64-
InformerConfiguration.builder(ConfigMap.class).build();
65-
assertTrue(informerConfig.isFollowControllerNamespacesOnChange());
63+
final var informerConfig = InformerConfiguration.builder(ConfigMap.class).build();
64+
assertTrue(informerConfig.getFollowControllerNamespacesChanges());
6665
}
6766

6867
@Test

0 commit comments

Comments
 (0)