diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java index 93e296924b..8f306e4d36 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationService.java @@ -318,8 +318,13 @@ private
ResolvedControllerConfiguration
controllerCon
final var dependentFieldManager =
fieldManager.equals(CONTROLLER_NAME_AS_FIELD_MANAGER) ? name : fieldManager;
+ // the deprecated triggerReconcilerOnAllEvent is still honored, otherwise enabling all-event
+ // mode under its former name would be silently ignored
+ @SuppressWarnings("removal")
var triggerReconcilerOnAllEvents =
- annotation != null && annotation.triggerReconcilerOnAllEvents();
+ annotation != null
+ && (annotation.triggerReconcilerOnAllEvents()
+ || annotation.triggerReconcilerOnAllEvent());
var defaultFilters = annotation == null || annotation.defaultFilters();
diff --git a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationServiceTest.java b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationServiceTest.java
new file mode 100644
index 0000000000..132ec2ddae
--- /dev/null
+++ b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/BaseConfigurationServiceTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright Java Operator SDK Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.javaoperatorsdk.operator.api.config;
+
+import org.junit.jupiter.api.Test;
+
+import io.fabric8.kubernetes.api.model.ConfigMap;
+import io.javaoperatorsdk.operator.api.reconciler.Context;
+import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration;
+import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
+import io.javaoperatorsdk.operator.api.reconciler.UpdateControl;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class BaseConfigurationServiceTest {
+
+ private final BaseConfigurationService configurationService = new BaseConfigurationService();
+
+ @Test
+ void readsTriggerReconcilerOnAllEvents() {
+ assertThat(
+ configurationService
+ .configFor(new AllEventsReconciler())
+ .triggerReconcilerOnAllEvents())
+ .isTrue();
+ }
+
+ @Test
+ void readsDeprecatedTriggerReconcilerOnAllEventAttribute() {
+ assertThat(
+ configurationService
+ .configFor(new DeprecatedAllEventsReconciler())
+ .triggerReconcilerOnAllEvents())
+ .isTrue();
+ }
+
+ @Test
+ void triggerReconcilerOnAllEventsDefaultsToFalse() {
+ assertThat(
+ configurationService.configFor(new DefaultReconciler()).triggerReconcilerOnAllEvents())
+ .isFalse();
+ }
+
+ @ControllerConfiguration(triggerReconcilerOnAllEvents = true)
+ private static class AllEventsReconciler implements Reconciler