Skip to content

Commit dd08cc2

Browse files
committed
samples update, smell fix
1 parent c60e078 commit dd08cc2

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/EventSourceManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ public void broadcastOnResourceEvent(ResourceAction action, R resource, R oldRes
145145

146146
public void changeNamespaces(Set<String> namespaces) {
147147
eventProcessor.stop();
148-
eventSources.allEventSources()
149-
.filter(es -> es instanceof NamespaceChangeable)
148+
eventSources
149+
.allEventSources()
150+
.filter(NamespaceChangeable.class::isInstance)
150151
.map(NamespaceChangeable.class::cast)
151152
.filter(NamespaceChangeable::allowsNamespaceChanges)
152153
.forEach(ies -> ies.changeNamespaces(namespaces));

sample-operators/tomcat-operator/src/main/java/io/javaoperatorsdk/operator/sample/WebappReconciler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public Map<String, EventSource> prepareEventSources(EventSourceContext<Webapp> c
6060

6161
InformerConfiguration<Tomcat> configuration =
6262
InformerConfiguration.from(Tomcat.class)
63+
.withNamespacesInheritedFromController(context)
6364
.withSecondaryToPrimaryMapper(webappsMatchingTomcatName)
6465
.build();
6566
return EventSourceInitializer

sample-operators/webpage/src/main/java/io/javaoperatorsdk/operator/sample/WebPageReconciler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,22 @@ public WebPageReconciler(KubernetesClient kubernetesClient) {
5252
public Map<String, EventSource> prepareEventSources(EventSourceContext<WebPage> context) {
5353
var configMapEventSource =
5454
new InformerEventSource<>(InformerConfiguration.from(ConfigMap.class)
55+
.withNamespacesInheritedFromController(context)
5556
.withLabelSelector(LOW_LEVEL_LABEL_KEY)
5657
.build(), context);
5758
var deploymentEventSource =
5859
new InformerEventSource<>(InformerConfiguration.from(Deployment.class)
60+
.withNamespacesInheritedFromController(context)
5961
.withLabelSelector(LOW_LEVEL_LABEL_KEY)
6062
.build(), context);
6163
var serviceEventSource =
6264
new InformerEventSource<>(InformerConfiguration.from(Service.class)
65+
.withNamespacesInheritedFromController(context)
6366
.withLabelSelector(LOW_LEVEL_LABEL_KEY)
6467
.build(), context);
6568
var ingressEventSource =
6669
new InformerEventSource<>(InformerConfiguration.from(Ingress.class)
70+
.withNamespacesInheritedFromController(context)
6771
.withLabelSelector(LOW_LEVEL_LABEL_KEY)
6872
.build(), context);
6973
return EventSourceInitializer.nameEventSources(configMapEventSource, deploymentEventSource,

0 commit comments

Comments
 (0)