Skip to content

Commit b61f2e9

Browse files
author
Dave Syer
committed
Fix SpringExampleController so it doesn't crash on startup
This fix is masking another problem somewhere else, but at least it gets the apps working while we investigate. Signed-off-by: Dave Syer <[email protected]>
1 parent 366aa1e commit b61f2e9

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

examples/examples-release-12/src/main/java/io/kubernetes/client/examples/SpringControllerExample.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ public KubernetesControllerFactory kubernetesReconcilerConfigurer(
7373
SharedInformerFactory sharedInformerFactory, Reconciler reconciler) {
7474
return new KubernetesControllerFactory(sharedInformerFactory, reconciler);
7575
}
76-
77-
// *REQUIRED*
78-
// Injecting your SharedInformerFactory class annotated `@KubernetesInformers`
79-
@Bean("sharedInformerFactory")
80-
public SharedInformerFactory sharedInformerFactory() {
81-
return new MySharedInformerFactory();
82-
}
8376
}
8477

8578
@KubernetesInformers({ // Defining what resources is the informer-factory actually watching.
@@ -100,6 +93,7 @@ public SharedInformerFactory sharedInformerFactory() {
10093
groupVersionResource =
10194
@GroupVersionResource(apiGroup = "", apiVersion = "v1", resourcePlural = "pods")),
10295
})
96+
@Component
10397
public static class MySharedInformerFactory extends SharedInformerFactory {}
10498

10599
// As long as a reconciler bean attached `@KubernetesReconciler` detected in the context, we

examples/examples-release-13/src/main/java/io/kubernetes/client/examples/SpringControllerExample.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ public KubernetesControllerFactory kubernetesReconcilerConfigurer(
7373
SharedInformerFactory sharedInformerFactory, Reconciler reconciler) {
7474
return new KubernetesControllerFactory(sharedInformerFactory, reconciler);
7575
}
76-
77-
// *REQUIRED*
78-
// Injecting your SharedInformerFactory class annotated `@KubernetesInformers`
79-
@Bean("sharedInformerFactory")
80-
public SharedInformerFactory sharedInformerFactory() {
81-
return new MySharedInformerFactory();
82-
}
8376
}
8477

8578
@KubernetesInformers({ // Defining what resources is the informer-factory actually watching.
@@ -100,6 +93,7 @@ public SharedInformerFactory sharedInformerFactory() {
10093
groupVersionResource =
10194
@GroupVersionResource(apiGroup = "", apiVersion = "v1", resourcePlural = "pods")),
10295
})
96+
@Component
10397
public static class MySharedInformerFactory extends SharedInformerFactory {}
10498

10599
// As long as a reconciler bean attached `@KubernetesReconciler` detected in the context, we

0 commit comments

Comments
 (0)