13
13
package io .kubernetes .client .extended .controller .builder ;
14
14
15
15
import io .kubernetes .client .common .KubernetesObject ;
16
- import io .kubernetes .client .extended .controller .*;
16
+ import io .kubernetes .client .extended .controller .Controller ;
17
+ import io .kubernetes .client .extended .controller .ControllerWatch ;
18
+ import io .kubernetes .client .extended .controller .Controllers ;
19
+ import io .kubernetes .client .extended .controller .DefaultController ;
17
20
import io .kubernetes .client .extended .controller .reconciler .Reconciler ;
18
21
import io .kubernetes .client .extended .controller .reconciler .Request ;
19
22
import io .kubernetes .client .extended .workqueue .DefaultRateLimitingQueue ;
20
23
import io .kubernetes .client .extended .workqueue .RateLimitingQueue ;
21
24
import io .kubernetes .client .extended .workqueue .WorkQueue ;
22
25
import io .kubernetes .client .informer .SharedIndexInformer ;
23
26
import io .kubernetes .client .informer .SharedInformerFactory ;
27
+
28
+ import java .time .Duration ;
24
29
import java .util .ArrayList ;
25
30
import java .util .List ;
26
31
import java .util .concurrent .Executors ;
@@ -33,6 +38,7 @@ public class DefaultControllerBuilder {
33
38
private int workerCount ;
34
39
private String controllerName ;
35
40
private RateLimitingQueue <Request > workQueue ;
41
+ private Duration readyTimeout ;
36
42
37
43
private SharedInformerFactory informerFactory ;
38
44
private List <Supplier <Boolean >> readyFuncs ;
@@ -114,6 +120,11 @@ public DefaultControllerBuilder withReadyFunc(Supplier<Boolean> readyFunc) {
114
120
return this ;
115
121
}
116
122
123
+ public DefaultControllerBuilder withReadyTimeout (Duration readyTimeout ) {
124
+ this .readyTimeout = readyTimeout ;
125
+ return this ;
126
+ }
127
+
117
128
/**
118
129
* Overrides worker thread counts of the controller.
119
130
*
@@ -154,6 +165,9 @@ public Controller build() throws IllegalStateException {
154
165
this .workQueue ,
155
166
this .readyFuncs .stream ().toArray (Supplier []::new ));
156
167
168
+ if (this .readyTimeout != null ) {
169
+ controller .setReadyTimeout (this .readyTimeout );
170
+ }
157
171
controller .setWorkerCount (this .workerCount );
158
172
controller .setWorkerThreadPool (
159
173
Executors .newScheduledThreadPool (
0 commit comments