diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/Informer.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/Informer.java index 3a425b786b..cdbf07a5c1 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/Informer.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/Informer.java @@ -13,7 +13,7 @@ import io.javaoperatorsdk.operator.processing.event.source.filter.OnDeleteFilter; import io.javaoperatorsdk.operator.processing.event.source.filter.OnUpdateFilter; -import static io.javaoperatorsdk.operator.api.reconciler.Constants.DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE; +import static io.javaoperatorsdk.operator.api.reconciler.Constants.DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES; import static io.javaoperatorsdk.operator.api.reconciler.Constants.NO_LONG_VALUE_SET; import static io.javaoperatorsdk.operator.api.reconciler.Constants.NO_VALUE_SET; @@ -88,7 +88,7 @@ * Set that in case of a runtime controller namespace changes, the informer should also follow the * new namespace set. */ - boolean followControllerNamespacesOnChange() default DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE; + boolean followControllerNamespaceChanges() default DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES; /** * Replaces the item store used by the informer for the associated primary resource controller. diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java index 334f8bb36b..2cefb21b1d 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerConfiguration.java @@ -29,7 +29,7 @@ public class InformerConfiguration { private final String resourceTypeName; private String name; private Set namespaces; - private Boolean followControllerNamespacesChanges; + private Boolean followsControllerNamespaceChanges; private String labelSelector; private OnAddFilter onAddFilter; private OnUpdateFilter onUpdateFilter; @@ -46,7 +46,7 @@ protected InformerConfiguration(Class resourceClass, String name, Set this(resourceClass); this.name = name; this.namespaces = namespaces; - this.followControllerNamespacesChanges = followControllerNamespacesOnChange; + this.followsControllerNamespaceChanges = followControllerNamespacesOnChange; this.labelSelector = labelSelector; this.onAddFilter = onAddFilter; this.onUpdateFilter = onUpdateFilter; @@ -75,7 +75,7 @@ public static InformerConfiguration.Builder builder( public static InformerConfiguration.Builder builder( InformerConfiguration original) { return new InformerConfiguration(original.resourceClass, original.name, original.namespaces, - original.followControllerNamespacesChanges, original.labelSelector, original.onAddFilter, + original.followsControllerNamespaceChanges, original.labelSelector, original.onAddFilter, original.onUpdateFilter, original.onDeleteFilter, original.genericFilter, original.itemStore, original.informerListLimit).builder; } @@ -184,8 +184,8 @@ public Set getEffectiveNamespaces(ControllerConfiguration controllerC * * @return if namespace changes should be followed */ - public boolean getFollowControllerNamespacesChanges() { - return followControllerNamespacesChanges; + public boolean getFollowsControllerNamespaceChanges() { + return followsControllerNamespaceChanges; } /** @@ -258,7 +258,7 @@ public InformerConfiguration buildForController() { namespaces = Constants.DEFAULT_NAMESPACES_SET; } // to avoid potential NPE - followControllerNamespacesChanges = false; + followsControllerNamespaceChanges = false; return InformerConfiguration.this; } @@ -267,9 +267,9 @@ public InformerConfiguration build() { if (namespaces == null || namespaces.isEmpty()) { namespaces = Constants.SAME_AS_CONTROLLER_NAMESPACES_SET; } - if (followControllerNamespacesChanges == null) { - followControllerNamespacesChanges = - DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE; + if (followsControllerNamespaceChanges == null) { + followsControllerNamespaceChanges = + DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES; } return InformerConfiguration.this; } @@ -305,7 +305,7 @@ public InformerConfiguration.Builder initFromAnnotation(Informer informerConf context)); withFollowControllerNamespacesChanges( - informerConfig.followControllerNamespacesOnChange()); + informerConfig.followControllerNamespaceChanges()); withItemStore(Utils.instantiate(informerConfig.itemStore(), ItemStore.class, context)); @@ -373,7 +373,7 @@ public Builder withWatchCurrentNamespace() { * @return the builder instance so that calls can be chained fluently */ public Builder withFollowControllerNamespacesChanges(boolean followChanges) { - InformerConfiguration.this.followControllerNamespacesChanges = + InformerConfiguration.this.followsControllerNamespaceChanges = followChanges; return this; } diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java index 532984cd8f..fecc3f05c7 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/informer/InformerEventSourceConfiguration.java @@ -35,7 +35,7 @@ static Builder from( * @return if namespace changes should be followed */ default boolean followControllerNamespaceChanges() { - return getInformerConfig().getFollowControllerNamespacesChanges(); + return getInformerConfig().getFollowsControllerNamespaceChanges(); } /** @@ -195,7 +195,7 @@ public void updateFrom(InformerConfiguration informerConfig) { } config.withNamespaces(informerConfig.getNamespaces()) .withFollowControllerNamespacesChanges( - informerConfig.getFollowControllerNamespacesChanges()) + informerConfig.getFollowsControllerNamespaceChanges()) .withLabelSelector(informerConfig.getLabelSelector()) .withItemStore(informerConfig.getItemStore()) .withOnAddFilter(informerConfig.getOnAddFilter()) diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java index 8003d8f836..0b0438bc23 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java @@ -25,7 +25,7 @@ public final class Constants { public static final String RESOURCE_GVK_KEY = "josdk.resource.gvk"; public static final String CONTROLLER_NAME = "controller.name"; - public static final boolean DEFAULT_FOLLOW_CONTROLLER_NAMESPACES_ON_CHANGE = true; + public static final boolean DEFAULT_FOLLOW_CONTROLLER_NAMESPACE_CHANGES = true; private Constants() {} } diff --git a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/InformerConfigurationTest.java b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/InformerConfigurationTest.java index fe4a11c10b..add6bcbeaa 100644 --- a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/InformerConfigurationTest.java +++ b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/InformerConfigurationTest.java @@ -47,8 +47,7 @@ void currentNamespaceWatched() { @Test void nullLabelSelectorByDefault() { - final var informerConfig = - InformerConfiguration.builder(ConfigMap.class).build(); + final var informerConfig = InformerConfiguration.builder(ConfigMap.class).build(); assertNull(informerConfig.getLabelSelector()); } @@ -61,7 +60,7 @@ void shouldWatchAllNamespacesByDefaultForControllers() { @Test void shouldFollowControllerNamespacesByDefaultForInformerEventSource() { final var informerConfig = InformerConfiguration.builder(ConfigMap.class).build(); - assertTrue(informerConfig.getFollowControllerNamespacesChanges()); + assertTrue(informerConfig.getFollowsControllerNamespaceChanges()); } @Test