Skip to content

Commit 5e0c0af

Browse files
committed
feat: log information about processed controller
1 parent 682ceb7 commit 5e0c0af

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

operator-framework-quarkus-extension/deployment/src/main/java/io/javaoperatorsdk/quarkus/extension/deployment/QuarkusExtensionProcessor.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@
3232
import org.jboss.jandex.ClassInfo;
3333
import org.jboss.jandex.DotName;
3434
import org.jboss.jandex.Type;
35+
import org.jboss.logging.Logger;
3536

3637
class QuarkusExtensionProcessor {
3738

39+
private static final Logger log = Logger.getLogger(QuarkusExtensionProcessor.class.getName());
40+
3841
private static final String FEATURE = "operator-sdk";
3942
private static final DotName RESOURCE_CONTROLLER =
4043
DotName.createSimple(ResourceController.class.getName());
@@ -112,7 +115,7 @@ private ControllerConfiguration createControllerConfiguration(
112115
if (controllerAnnotation == null) {
113116
throw new IllegalArgumentException(
114117
resourceControllerClassName
115-
+ " is missing the "
118+
+ " is missing the @"
116119
+ Controller.class.getCanonicalName()
117120
+ " annotation");
118121
}
@@ -131,16 +134,21 @@ private ControllerConfiguration createControllerConfiguration(
131134
// retrieve CRD name from CR type
132135
final var crdName = CustomResource.getCRDName(crClass);
133136

137+
// register CR class for introspection
138+
reflectionClasses.produce(new ReflectiveClassBuildItem(true, true, crClass));
139+
140+
final var name =
141+
valueOrDefault(
142+
controllerAnnotation,
143+
"name",
144+
AnnotationValue::asString,
145+
() -> ControllerUtils.getDefaultResourceControllerName(resourceControllerClassName));
146+
134147
// create the configuration
135148
final var configuration =
136149
new QuarkusControllerConfiguration(
137150
resourceControllerClassName,
138-
valueOrDefault(
139-
controllerAnnotation,
140-
"name",
141-
AnnotationValue::asString,
142-
() ->
143-
ControllerUtils.getDefaultResourceControllerName(resourceControllerClassName)),
151+
name,
144152
crdName,
145153
valueOrDefault(
146154
controllerAnnotation,
@@ -164,6 +172,10 @@ private ControllerConfiguration createControllerConfiguration(
164172
null // todo: fix-me
165173
);
166174

175+
log.infov(
176+
"Processed ''{0}'' controller named ''{1}'' for ''{2}'' CR (version ''{3}'')",
177+
info.name().toString(), name, cr.getCRDName(), cr.getApiVersion());
178+
167179
return configuration;
168180
}
169181

0 commit comments

Comments
 (0)