19
19
import io .kubernetes .client .informer .SharedInformer ;
20
20
import io .kubernetes .client .informer .SharedInformerFactory ;
21
21
import io .kubernetes .client .informer .cache .Lister ;
22
- import io .kubernetes .client .openapi .ApiClient ;
23
22
import io .kubernetes .client .openapi .models .V1Node ;
24
23
import io .kubernetes .client .openapi .models .V1NodeList ;
25
24
import io .kubernetes .client .openapi .models .V1Pod ;
26
25
import io .kubernetes .client .openapi .models .V1PodList ;
27
- import io .kubernetes .client .spring .extended .controller .KubernetesInformerConfigurer ;
28
26
import io .kubernetes .client .spring .extended .controller .annotation .*;
29
27
import io .kubernetes .client .spring .extended .controller .factory .KubernetesControllerFactory ;
30
- import io .kubernetes .client .spring .extended .controller .metrics .PrometheusScrapeEndpoint ;
31
- import io .kubernetes .client .util .ClientBuilder ;
32
- import java .io .IOException ;
33
- import java .time .Duration ;
34
28
import org .springframework .beans .factory .annotation .Autowired ;
35
29
import org .springframework .beans .factory .annotation .Qualifier ;
36
30
import org .springframework .beans .factory .annotation .Value ;
@@ -64,14 +58,6 @@ public CommandLineRunner commandLineRunner(
64
58
};
65
59
}
66
60
67
- // *REQUIRED*
68
- // Configurer components that registers informers to the informer-factory in the context.
69
- @ Bean
70
- public KubernetesInformerConfigurer kubernetesInformerConfigurer (
71
- ApiClient apiClient , SharedInformerFactory sharedInformerFactory ) {
72
- return new KubernetesInformerConfigurer (apiClient , sharedInformerFactory );
73
- }
74
-
75
61
// *REQUIRED*
76
62
// factorybean to crete controller
77
63
@ Bean ("node-printing-controller" )
@@ -80,30 +66,12 @@ public KubernetesControllerFactory kubernetesReconcilerConfigurer(
80
66
return new KubernetesControllerFactory (sharedInformerFactory , reconciler );
81
67
}
82
68
83
- // *OPTIONAL*
84
- // Injecting and customize your ApiClient, if not specified, fallbacks to {@link
85
- // io.kubernetes.client.util.ClientBuilder#standard}
86
- @ Bean
87
- public ApiClient myApiClient () throws IOException {
88
- ApiClient apiClient = ClientBuilder .standard ().build ();
89
- return apiClient .setHttpClient (
90
- apiClient .getHttpClient ().newBuilder ().readTimeout (Duration .ZERO ).build ());
91
- }
92
-
93
69
// *REQUIRED*
94
70
// Injecting your SharedInformerFactory class annotated `@KubernetesInformers`
95
71
@ Bean ("sharedInformerFactory" )
96
72
public SharedInformerFactory sharedInformerFactory () {
97
73
return new MySharedInformerFactory ();
98
74
}
99
-
100
- // *OPTIONAL*
101
- // Enabling prometheus scraping endpoint at `/actuator/prometheus`
102
- // SHOULD set `management.endpoints.web.exposure.include=prometheus` property.
103
- @ Bean
104
- public PrometheusScrapeEndpoint prometheusScrapeEndpoint () {
105
- return new PrometheusScrapeEndpoint ();
106
- }
107
75
}
108
76
109
77
@ KubernetesInformers ({ // Defining what resources is the informer-factory actually watching.
0 commit comments