@@ -63,14 +63,15 @@ Add [dependency](https://search.maven.org/search?q=a:operator-framework) to your
63
63
</dependency >
64
64
```
65
65
66
- Main method initializing the Operator and registering a controller..
66
+ Main method initializing the Operator and registering a controller.
67
67
68
68
``` java
69
69
public class Runner {
70
70
71
71
public static void main (String [] args ) {
72
- Operator operator = new Operator (new DefaultKubernetesClient ());
73
- operator. registerController(new WebServerController ());
72
+ Operator operator = new Operator (new DefaultKubernetesClient (),
73
+ DefaultConfigurationService . instance());
74
+ operator. register(new WebServerController ());
74
75
}
75
76
}
76
77
```
@@ -135,18 +136,62 @@ public class WebServerSpec {
135
136
}
136
137
}
137
138
```
139
+
140
+ #### Quarkus
141
+
142
+ A [ Quarkus] ( https://quarkus.io ) extension is also provided to ease the development of Quarkus-based operators.
143
+
144
+ Add [ this dependency] (https://search.maven.org/search?q=a:operator-framework-quarkus-extension )
145
+ to your project:
146
+
147
+ ``` xml
148
+ <dependency >
149
+ <groupId >io.javaoperatorsdk</groupId >
150
+ <artifactId >operator-framework-quarkus-extension</artifactId >
151
+ <version >{see https://search.maven.org/search?q=a:operator-framework-quarkus-extension for latest version}</version >
152
+ </dependency >
153
+ ```
154
+
155
+ Create an Application, Quarkus will automatically create and inject a ` KubernetesClient ` , ` Operator `
156
+ and ` ConfigurationService ` instances that your application can use, as shown below:
157
+
158
+ ``` java
159
+ @QuarkusMain
160
+ public class QuarkusOperator implements QuarkusApplication {
161
+
162
+ @Inject KubernetesClient client;
163
+
164
+ @Inject Operator operator;
165
+
166
+ @Inject ConfigurationService configuration;
167
+
168
+ public static void main (String ... args ) {
169
+ Quarkus . run(QuarkusOperator . class, args);
170
+ }
171
+
172
+ @Override
173
+ public int run (String ... args ) throws Exception {
174
+ final var config = configuration. getConfigurationFor(new CustomServiceController (client));
175
+ System . out. println(" CR class: " + config. getCustomResourceClass());
176
+ System . out. println(" Doneable class = " + config. getDoneableClass());
177
+
178
+ Quarkus . waitForExit();
179
+ return 0 ;
180
+ }
181
+ }
182
+ ```
138
183
139
184
#### Spring Boot
140
185
141
186
You can also let Spring Boot wire your application together and automatically register the controllers.
142
187
143
- Add [ this dependency] ( https://search.maven.org/search?q=a:spring-boot- operator-framework-starter ) to your project:
188
+ Add [ this dependency] ( https://search.maven.org/search?q=a:operator-framework-spring-boot -starter ) to your project:
144
189
145
190
``` xml
146
191
<dependency >
147
192
<groupId >io.javaoperatorsdk</groupId >
148
- <artifactId >spring-boot- operator-framework-starter</artifactId >
149
- <version >{see https://search.maven.org/search?q=a:spring-boot- operator-framework-starter for latest version}</version >
193
+ <artifactId >operator-framework-spring-boot -starter</artifactId >
194
+ <version >{see https://search.maven.org/search?q=a:operator-framework-spring-boot -starter for latest version}</version >
150
195
</dependency >
151
196
```
152
197
0 commit comments