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
+ import java .time .Duration ;
24
28
import java .util .ArrayList ;
25
29
import java .util .List ;
26
30
import java .util .concurrent .Executors ;
@@ -33,6 +37,7 @@ public class DefaultControllerBuilder {
33
37
private int workerCount ;
34
38
private String controllerName ;
35
39
private RateLimitingQueue <Request > workQueue ;
40
+ private Duration readyTimeout ;
36
41
37
42
private SharedInformerFactory informerFactory ;
38
43
private List <Supplier <Boolean >> readyFuncs ;
@@ -114,6 +119,11 @@ public DefaultControllerBuilder withReadyFunc(Supplier<Boolean> readyFunc) {
114
119
return this ;
115
120
}
116
121
122
+ public DefaultControllerBuilder withReadyTimeout (Duration readyTimeout ) {
123
+ this .readyTimeout = readyTimeout ;
124
+ return this ;
125
+ }
126
+
117
127
/**
118
128
* Overrides worker thread counts of the controller.
119
129
*
@@ -154,6 +164,9 @@ public Controller build() throws IllegalStateException {
154
164
this .workQueue ,
155
165
this .readyFuncs .stream ().toArray (Supplier []::new ));
156
166
167
+ if (this .readyTimeout != null ) {
168
+ controller .setReadyTimeout (this .readyTimeout );
169
+ }
157
170
controller .setWorkerCount (this .workerCount );
158
171
controller .setWorkerThreadPool (
159
172
Executors .newScheduledThreadPool (
0 commit comments