32
32
import org .jboss .jandex .ClassInfo ;
33
33
import org .jboss .jandex .DotName ;
34
34
import org .jboss .jandex .Type ;
35
+ import org .jboss .logging .Logger ;
35
36
36
37
class QuarkusExtensionProcessor {
37
38
39
+ private static final Logger log = Logger .getLogger (QuarkusExtensionProcessor .class .getName ());
40
+
38
41
private static final String FEATURE = "operator-sdk" ;
39
42
private static final DotName RESOURCE_CONTROLLER =
40
43
DotName .createSimple (ResourceController .class .getName ());
@@ -112,7 +115,7 @@ private ControllerConfiguration createControllerConfiguration(
112
115
if (controllerAnnotation == null ) {
113
116
throw new IllegalArgumentException (
114
117
resourceControllerClassName
115
- + " is missing the "
118
+ + " is missing the @ "
116
119
+ Controller .class .getCanonicalName ()
117
120
+ " annotation" );
118
121
}
@@ -131,16 +134,21 @@ private ControllerConfiguration createControllerConfiguration(
131
134
// retrieve CRD name from CR type
132
135
final var crdName = CustomResource .getCRDName (crClass );
133
136
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
+
134
147
// create the configuration
135
148
final var configuration =
136
149
new QuarkusControllerConfiguration (
137
150
resourceControllerClassName ,
138
- valueOrDefault (
139
- controllerAnnotation ,
140
- "name" ,
141
- AnnotationValue ::asString ,
142
- () ->
143
- ControllerUtils .getDefaultResourceControllerName (resourceControllerClassName )),
151
+ name ,
144
152
crdName ,
145
153
valueOrDefault (
146
154
controllerAnnotation ,
@@ -164,6 +172,10 @@ private ControllerConfiguration createControllerConfiguration(
164
172
null // todo: fix-me
165
173
);
166
174
175
+ log .infov (
176
+ "Processed ''{0}'' controller named ''{1}'' for ''{2}'' CR (version ''{3}'')" ,
177
+ info .name ().toString (), name , cr .getCRDName (), cr .getApiVersion ());
178
+
167
179
return configuration ;
168
180
}
169
181
0 commit comments