You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So that the project can be packaged as a executable jar. See the example class [here](https://github.com/yue9944882/replicaset-controller/blob/master/src/main/java/com/github/yue9944882/kubernetes/Application.java).
52
74
53
-
#### Loading Post-Processor Spring Beans
75
+
#####Loading Post-Processor Spring Beans (Required only if you're using < 11.0.0 releases)
54
76
55
77
Adding the following annotation to whatever Java class under spring context, so that processors can be activated.
56
78
@@ -60,10 +82,6 @@ Adding the following annotation to whatever Java class under spring context, so
60
82
61
83
Corresponding example is available [here](https://github.com/yue9944882/replicaset-controller/blob/master/src/main/java/com/github/yue9944882/kubernetes/config/ControllerConfiguration.java#L20).
62
84
63
-
__NOTE__: In the future releases (already landed on master, will release after 11.0.0), you will be able to activate the processors by configuration-
64
-
beans. To previewing the feature, you can take a glance at the test codes for [KubernetesReconcilerConfigurer](https://github.com/kubernetes-client/java/blob/351ffa13d49cb76445788d78bf83e03a5edf139a/spring/src/test/java/io/kubernetes/client/spring/extended/controller/KubernetesReconcilerCreatorTest.java#L75-L79) and
You're supposed to create a new class (can be a inner-class) extending `io.kubernetes.client.informer.SharedInformerFactory`,
@@ -99,10 +117,11 @@ The registered informer-factory won't be running unless you explcitly calls `sta
99
117
the method is the trigger to run the controller, so hold it carefully until you're ready :). In the example project, the
100
118
informer-factory was started inside `ControllerManager#run`.
101
119
102
-
The [KubernetesInformerFactoryProcessor](https://github.com/kubernetes-client/java/blob/master/spring/src/main/java/io/kubernetes/client/spring/extended/controller/KubernetesInformerFactoryProcessor.java)
103
-
will be parsing the `@KubernetesInformers` annotation on informer-factory class and then register `SharedInformer` and
104
-
`Lister` beans for the kubernetes resource classes. You can easily acquire them by declaring them as parameters in the
105
-
bean method. See this example source to see the per-resource informer/lister bean registration [here](https://github.com/yue9944882/replicaset-controller/blob/c8dda02fe444d7154117b9bf0583557502694e1b/src/main/java/com/github/yue9944882/kubernetes/config/ControllerConfiguration.java#L35-L43).
120
+
As a deeper insight, it's the [KubernetesInformerFactoryProcessor](https://github.com/kubernetes-client/java/blob/master/spring/src/main/java/io/kubernetes/client/spring/extended/controller/KubernetesInformerFactoryProcessor.java)
121
+
parsing the `@KubernetesInformers` annotation on informer-factory class and then register `SharedInformer` and
122
+
`Lister` beans for the kubernetes resource classes. You can easily acquire them by `@Autowired` (for >= 11.0.0 release)
123
+
or declaring them as parameters in the bean method. See this example source to see the per-resource informer/lister
@@ -126,10 +145,78 @@ the watch connections are managed by informer-factory and they're multiplex'd. S
126
145
to the watch connection. For more detail, take a look at the example code [here](https://github.com/yue9944882/replicaset-controller/blob/c8dda02fe444d7154117b9bf0583557502694e1b/src/main/java/com/github/yue9944882/kubernetes/ReplicaSetReconciler.java#L27-L40).
127
146
128
147
148
+
#### Injecting Informer/Lister using @Autowired (Optional for >= 11.0.0 releases)
149
+
150
+
You can easily acquire `SharedInformer` and `Lister` instances via `@Autowired` annotations instead of passing them from
Copy file name to clipboardExpand all lines: spring/src/main/java/io/kubernetes/client/spring/extended/controller/KubernetesInformerFactoryProcessor.java
0 commit comments