Skip to content

Commit 60216a4

Browse files
authored
fix: do not output warning when resolving a configuration (#2892)
* fix: do not output warning when resolving a configuration * fix: remove test code that shouldn't have been included * fix: remove duplicated line --------- Signed-off-by: Chris Laprun <[email protected]>
1 parent 660ee93 commit 60216a4

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030

3131
import static io.javaoperatorsdk.operator.api.config.ControllerConfiguration.CONTROLLER_NAME_AS_FIELD_MANAGER;
3232

33+
/**
34+
* A default {@link ConfigurationService} implementation, resolving {@link Reconciler}s
35+
* configuration when it has already been resolved before. If this behavior is not adequate, please
36+
* use {@link AbstractConfigurationService} instead as a base for your {@code ConfigurationService}
37+
* implementation.
38+
*/
3339
public class BaseConfigurationService extends AbstractConfigurationService {
3440

3541
private static final String LOGGER_NAME = "Default ConfigurationService implementation";
@@ -149,10 +155,12 @@ private static void configureFromAnnotatedReconciler(
149155

150156
@Override
151157
protected void logMissingReconcilerWarning(String reconcilerKey, String reconcilersNameMessage) {
152-
logger.warn(
153-
"Configuration for reconciler '{}' was not found. {}",
154-
reconcilerKey,
155-
reconcilersNameMessage);
158+
if (!createIfNeeded()) {
159+
logger.warn(
160+
"Configuration for reconciler '{}' was not found. {}",
161+
reconcilerKey,
162+
reconcilersNameMessage);
163+
}
156164
}
157165

158166
@SuppressWarnings("unused")
@@ -318,6 +326,13 @@ private <P extends HasMetadata> ResolvedControllerConfiguration<P> controllerCon
318326
informerConfig);
319327
}
320328

329+
/**
330+
* @deprecated This method was meant to allow subclasses to prevent automatic creation of the
331+
* configuration when not found. This functionality is now removed, if you want to be able to
332+
* prevent automated, on-demand creation of a reconciler's configuration, please use the
333+
* {@link AbstractConfigurationService} implementation instead as base for your extension.
334+
*/
335+
@Deprecated(forRemoval = true)
321336
protected boolean createIfNeeded() {
322337
return true;
323338
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ default Set<Class<? extends HasMetadata>> withPreviousAnnotationForDependentReso
485485
*
486486
* @return if resource version should be parsed (as integer)
487487
* @since 4.5.0
488-
* @return if resource version should be parsed (as integer)
489488
*/
490489
default boolean parseResourceVersionsForEventFilteringAndCaching() {
491490
return false;

0 commit comments

Comments
 (0)