1
1
package io .javaoperatorsdk .operator ;
2
2
3
+ import java .net .ConnectException ;
4
+ import java .util .ArrayList ;
5
+ import java .util .HashMap ;
6
+ import java .util .List ;
7
+ import java .util .Map ;
8
+
9
+ import org .slf4j .Logger ;
10
+ import org .slf4j .LoggerFactory ;
11
+
3
12
import io .fabric8 .kubernetes .client .CustomResource ;
4
13
import io .fabric8 .kubernetes .client .DefaultKubernetesClient ;
5
14
import io .fabric8 .kubernetes .client .KubernetesClient ;
10
19
import io .javaoperatorsdk .operator .api .config .ControllerConfiguration ;
11
20
import io .javaoperatorsdk .operator .api .config .ExecutorServiceManager ;
12
21
import io .javaoperatorsdk .operator .processing .ConfiguredController ;
13
- import org .slf4j .Logger ;
14
- import org .slf4j .LoggerFactory ;
15
-
16
- import java .net .ConnectException ;
17
- import java .util .ArrayList ;
18
- import java .util .HashMap ;
19
- import java .util .List ;
20
- import java .util .Map ;
21
22
22
23
@ SuppressWarnings ("rawtypes" )
23
24
public class Operator implements AutoCloseable , LifecycleAware {
@@ -110,12 +111,12 @@ public void close() {
110
111
* registration of the controller is delayed till the operator is started.
111
112
*
112
113
* @param controller the controller to register
113
- * @param <R> the {@code CustomResource} type associated with the controller
114
+ * @param <R> the {@code CustomResource} type associated with the controller
114
115
* @throws OperatorException if a problem occurred during the registration process
115
116
*/
116
117
public <R extends CustomResource <?, ?>> void register (ResourceController <R > controller )
117
- throws OperatorException {
118
- register (controller , null );
118
+ throws OperatorException {
119
+ register (controller , null );
119
120
}
120
121
121
122
/**
@@ -132,22 +133,22 @@ public void close() {
132
133
* @throws OperatorException if a problem occurred during the registration process
133
134
*/
134
135
public <R extends CustomResource <?, ?>> void register (
135
- ResourceController <R > controller , ControllerConfiguration <R > configuration )
136
- throws OperatorException {
137
- final var existing = configurationService .getConfigurationFor (controller );
138
- if (existing == null ) {
139
- log .warn (
140
- "Skipping registration of {} controller named {} because its configuration cannot be found.\n "
141
- + "Known controllers are: {}" ,
142
- controller .getClass ().getCanonicalName (),
143
- ControllerUtils .getNameFor (controller ),
144
- configurationService .getKnownControllerNames ());
136
+ ResourceController <R > controller , ControllerConfiguration <R > configuration )
137
+ throws OperatorException {
138
+ final var existing = configurationService .getConfigurationFor (controller );
139
+ if (existing == null ) {
140
+ log .warn (
141
+ "Skipping registration of {} controller named {} because its configuration cannot be found.\n "
142
+ + "Known controllers are: {}" ,
143
+ controller .getClass ().getCanonicalName (),
144
+ ControllerUtils .getNameFor (controller ),
145
+ configurationService .getKnownControllerNames ());
145
146
} else {
146
147
if (configuration == null ) {
147
148
configuration = existing ;
148
149
}
149
- final var configuredController =
150
- new ConfiguredController <>(controller , configuration , kubernetesClient );
150
+ final var configuredController =
151
+ new ConfiguredController <>(controller , configuration , kubernetesClient );
151
152
controllers .add (configuredController );
152
153
153
154
final var watchedNS =
0 commit comments