-
Notifications
You must be signed in to change notification settings - Fork 224
fix: do not output warning when resolving a configuration #2892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,12 @@ | |
|
||
import static io.javaoperatorsdk.operator.api.config.ControllerConfiguration.CONTROLLER_NAME_AS_FIELD_MANAGER; | ||
|
||
/** | ||
* A default {@link ConfigurationService} implementation, resolving {@link Reconciler}s | ||
* configuration when it has already been resolved before. If this behavior is not adequate, please | ||
* use {@link AbstractConfigurationService} instead as a base for your {@code ConfigurationService} | ||
* implementation. | ||
*/ | ||
public class BaseConfigurationService extends AbstractConfigurationService { | ||
|
||
private static final String LOGGER_NAME = "Default ConfigurationService implementation"; | ||
|
@@ -149,10 +155,12 @@ private static void configureFromAnnotatedReconciler( | |
|
||
@Override | ||
protected void logMissingReconcilerWarning(String reconcilerKey, String reconcilersNameMessage) { | ||
logger.warn( | ||
"Configuration for reconciler '{}' was not found. {}", | ||
reconcilerKey, | ||
reconcilersNameMessage); | ||
if (!createIfNeeded()) { | ||
logger.warn( | ||
"Configuration for reconciler '{}' was not found. {}", | ||
reconcilerKey, | ||
reconcilersNameMessage); | ||
} | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
|
@@ -318,6 +326,13 @@ private <P extends HasMetadata> ResolvedControllerConfiguration<P> controllerCon | |
informerConfig); | ||
} | ||
|
||
/** | ||
* @deprecated This method was meant to allow subclasses to prevent automatic creation of the | ||
* configuration when not found. This functionality is now removed, if you want to be able to | ||
* prevent automated, on-demand creation of a reconciler's configuration, please use the | ||
* {@link AbstractConfigurationService} implementation instead as base for your extension. | ||
*/ | ||
@Deprecated(forRemoval = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat strange to introduce a new usage of the method and deprecate it at the same time. How will this be handled when this method is removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation uses the method but the documentation explains what should happen instead. It's only deprecated to avoid API breakage in case implementations use it but this method should really be removed, because, as far as I'm aware, there is no implementation that doesn't currently return |
||
protected boolean createIfNeeded() { | ||
return true; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the probelm we are solving this method evetually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean in quarkus operator sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, the issue is preserving the possibility to log (or do something else, if needed) if the configuration doesn't exist in the abstract class, without logging when the configuration is created in
BaseConfigurationService
. Removing the logging andcreateIfNeeded
methods would be API breaking changes so the goal is to have an implementation that doesn't break the existing API and doesn't log a warning when a configuration is created on-demand.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, approved