4
4
import java .util .Collections ;
5
5
import java .util .HashMap ;
6
6
import java .util .Map ;
7
+ import java .util .Optional ;
7
8
import java .util .stream .Stream ;
8
9
9
10
import org .slf4j .Logger ;
18
19
import io .javaoperatorsdk .operator .api .config .AbstractConfigurationService ;
19
20
import io .javaoperatorsdk .operator .api .config .Cloner ;
20
21
import io .javaoperatorsdk .operator .api .config .ControllerConfiguration ;
22
+ import io .javaoperatorsdk .operator .api .config .InformerStoppedHandler ;
23
+ import io .javaoperatorsdk .operator .api .config .LeaderElectionConfiguration ;
21
24
import io .javaoperatorsdk .operator .api .config .Version ;
22
25
import io .javaoperatorsdk .operator .api .config .dependent .DependentResourceSpec ;
23
26
import io .javaoperatorsdk .operator .api .monitoring .Metrics ;
@@ -38,14 +41,17 @@ public class QuarkusConfigurationService extends AbstractConfigurationService {
38
41
private final Map <String , String > reconcilerClassToName ;
39
42
private final Metrics metrics ;
40
43
private final boolean startOperator ;
44
+ private final LeaderElectionConfiguration leaderElectionConfiguration ;
45
+ private final InformerStoppedHandler informerStoppedHandler ;
41
46
42
47
@ SuppressWarnings ({ "rawtypes" , "unchecked" })
43
48
public QuarkusConfigurationService (
44
49
Version version ,
45
50
Collection <QuarkusControllerConfiguration > configurations ,
46
51
KubernetesClient client ,
47
52
CRDGenerationInfo crdInfo , int maxThreads ,
48
- int timeout , Metrics metrics , boolean startOperator , ObjectMapper mapper ) {
53
+ int timeout , Metrics metrics , boolean startOperator , ObjectMapper mapper ,
54
+ LeaderElectionConfiguration leaderElectionConfiguration , InformerStoppedHandler informerStoppedHandler ) {
49
55
super (version );
50
56
final var cloner = new Cloner () {
51
57
@ Override
@@ -73,6 +79,8 @@ public <R extends HasMetadata> R clone(R r) {
73
79
this .crdInfo = crdInfo ;
74
80
this .concurrentReconciliationThreads = maxThreads ;
75
81
this .terminationTimeout = timeout ;
82
+ this .informerStoppedHandler = informerStoppedHandler ;
83
+ this .leaderElectionConfiguration = leaderElectionConfiguration ;
76
84
}
77
85
78
86
@ Override
@@ -171,4 +179,14 @@ public DependentResourceFactory dependentResourceFactory() {
171
179
public Stream <ControllerConfiguration > controllerConfigurations () {
172
180
return super .controllerConfigurations ();
173
181
}
182
+
183
+ @ Override
184
+ public Optional <LeaderElectionConfiguration > getLeaderElectionConfiguration () {
185
+ return Optional .ofNullable (leaderElectionConfiguration );
186
+ }
187
+
188
+ @ Override
189
+ public Optional <InformerStoppedHandler > getInformerStoppedHandler () {
190
+ return Optional .ofNullable (informerStoppedHandler );
191
+ }
174
192
}
0 commit comments